wix / react-native-notifications

React Native Notifications
MIT License
3.25k stars 764 forks source link

registerNotificationOpened isn't working as expected in iOS #1018

Open bhanuprakash1226 opened 11 months ago

bhanuprakash1226 commented 11 months ago

registerNotificationOpened method isn't working as expected in the scenario: when the app receives a notification in the foreground state and I open the app post killing the app by tapping on a notification.

But the given method is working as expected when the app receives a notification in the killed and background states and opens the app from the killed state by tapping a notification.

Notifications.events().registerNotificationOpened((notification: Notification, completion: () => void, action: NotificationActionResponse) => {
      completion();
});

Using the latest version: 5.1.0 RN version:0.72.5 iOS: 17.1.2

katwal-dipak commented 7 months ago

Similar issue here. The workaround was using notifee library for iOS

useEffect(() => {
   if (Platform.OS === 'ios') {
    return notifee.onForegroundEvent(({type, detail}) => {
      switch (type) {
        case EventType.PRESS:
          // Handle notification payload
          }
          break;
      }
    });
     }
  }, []);