【问题标题】:React Native Firebase v4.0 - Notification ModuleReact Native Firebase v4.0 - 通知模块
【发布时间】:2018-03-22 19:29:31
【问题描述】:

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

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

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

在“行动”

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

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;
        });
}

【问题讨论】:

    标签: javascript react-native react-native-firebase


    【解决方案1】:

    我需要做的就是将 notificationOpen: NotificationOpen 放在括号内。

    (notificationOpen: NotificationOpen)
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-29
    • 2021-09-30
    • 2021-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多