带计数器的React-Native-Push-Notification问题

时间:2019-10-21 15:19:46

标签: react-native react-native-android

通知计数器的显示不超过9。它显示10,并立即重置为9。它不依赖于通知的其他数量。 创建硝化时的代码:

sendNotificationImmediately = (message) => {
        if (Platform.OS === 'android') {
            PushNotification.localNotification({
                title: 'Оператор прислал сообщение',
                message: message,
            });
        } else {
            PushNotification.presentLocalNotification({
                alertBody: message,
                applicationIconBadgeNumber: this.state.counter
            });
        }
    };

删除通知时的代码:

if (Platform.OS === 'android')
            PushNotification.cancelAllLocalNotifications()

0 个答案:

没有答案