zo0r / react-native-push-notification

React Native Local and Remote Notifications
MIT License
6.77k stars 2.05k forks source link

Foreground onNotification behaviour on iOS #2389

Open abdymm opened 1 year ago

abdymm commented 1 year ago

Question

Hi guys, just want to know the correct behavior when the app is in FOREGROUND, on the onNotification currently on Android the onNotification will be triggered when a notification is received and the user taps it, but on iOS its triggered only when the user taps the notification, is this expected behaviour?

trevor-mobileup commented 1 year ago

We are also experiencing this issue. I understand it's unlikely to see this get fixed/looked into at this point, but I am commenting and getting this activity in the hopes that someone on the library has found a workaround. Migrating is a big ask for our legacy app, and we're hoping for a band-aid solution until then.

trevor-mobileup commented 1 year ago

@abdymm Through other issues we found the following two lines that we added to our AppDelegate.mm:

NSDictionary *userInfo = notification.request.content.userInfo; [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo];

We added these to willPresentNotification like so:

image

Though our issue now is that the userInteraction property doesn't seem to be set properly on the notification object in the onNotification callback. Separate issue though, hope the above helps

github-actions[bot] commented 2 weeks ago

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.