react-native-notifications: iOS cannot receive first push notification when open in foreground
Version: 3.1.2 RN version: 0.61.5
Using this version and lines from documentation
Notifications.events().registerNotificationReceivedForeground((notification: Notification, completion: (response: NotificationCompletion) => void) => {
console.log("Notification Received - Foreground", notification.payload);
// Calling completion on iOS with `alert: true` will present the native iOS inApp notification.
completion({alert: true, sound: true, badge: false});
});
I can only see the push notification alert starts from 2nd push notification, but not the first one.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 15
To fix this bug in RN notifications 3.1.4, go first to
RNNotificationsStore.m, then find the initializer and apply this changes (you can also apply this patch usingpatch-package):I won’t put together a PR because it seems that the maintainers are not accepting/reviewing PRs, however, if @yogevbd is willing to review it, I’ll be glad to do it.
My current fix:
[RNNotifications addNativeDelegate:self];in didFinishLaunchingWithOptionsWhen you set this -
[RNNotifications addNativeDelegate:self];you will not be able to get notification from event listenerNotifications.events().registerNotificationOpenedthat method will not triggerSame problem