我正在创建一个剩余的应用程序,其中我无法从通知区域中删除通知,我已经尝试了许多方法来解决这个问题,但仍然没有任何帮助。PushNotification.clearLocalNotification(parseInt(notification.id, 10));
也试过类似的解决方案,如 PushNotification.cancelLocalNotifications({ id: `${parseInt(notification.id, 10)}` });
.但还是无济于事。我试着记录了一下节点包,可以看到记录里面有清除通知的java函数cancel函数,还是没有从通知区中驳回来
编辑:我想在动作(按钮)按下时解除通知。
使用 autoCancel: true
要取消通知,请点击
export const LocalNotification = () => {
PushNotification.localNotification({
autoCancel: true,
bigText:
'This is local notification demo in React Native app. Only shown, when expanded.',
subText: 'Local Notification Demo',
title: 'Local Notification Title',
message: 'Expand me to see more',
vibrate: true,
vibration: 300,
playSound: true,
soundName: 'default',
actions: '["Yes", "No"]'
})
}