PushNotification.localNotification({
...
userInfo: { id: '123' }
...
});
Both of them are not working for me so I found a workaround
This method is for Android only:
PushNotification.clearAllNotifications();
I edited it from this
function() {
return this.callNative('clearAllNotifications', arguments);
}
to this
function() {
if (Platform.OS === 'ios') return this.callNative('removeAllDeliveredNotifications', arguments);
return this.callNative('clearAllNotifications', arguments);
}
So now it works for iOS and I can use it to remove all the notifications
A workaround in any shared code looks very similar:
import { Platform, PushNotificationIOS } from 'react-native';
...
if (Platform.OS === 'ios') {
PushNotificationIOS.removeAllDeliveredNotifications();
}
Thanks for putting me on the right path @simonepauro !
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
Most helpful comment
A workaround in any shared code looks very similar:
Thanks for putting me on the right path @simonepauro !