1

我刚刚安装了 react-native-firebase v4.0,我试图检测何时有人打开了我从谷歌控制台发送的通知。

但是当我将文档中的示例放入我的代码中时,我得到了

解析错误:意外令牌,预期:(​​致命)

在“行动”

我在这里想念什么?我以前从未使用过这种语法。

componentDidMount() {
    this.notificationOpenedListener = firebase.notifications().onNotificationOpened(notificationOpen: NotificationOpen => {
            // Get the action triggered by the notification being opened
            const action = notificationOpen.action;
            // Get information about the notification that was opened
            const notification: Notification = notificationOpen.notification;
        });
}
4

1 回答 1

0

我需要做的就是把 notificationOpen: NotificationOpen 放在括号里。

(notificationOpen: NotificationOpen)
于 2018-03-22T19:51:33.947 回答