react-native-firebase ejected app crashed on notification click (iOS)

Hello Exponautes!

We are using react-native-firebase lib to handle our push notifications with the following snippet:

    firebase.notifications().getInitialNotification().then(notificationOpen => {
      if (notificationOpen) {
        this.onInitialNotificationReceived(notificationOpen.notification);
      }
    });

On Android it works as expected, when we click on the notification, the app starts and the listener received the notificationOpen event.

On iOS the app runs perfectly fine by itself, but when we click on a notification, its an instant crash.

Android app -> start -> OK
Android app stop -> send notification -> click on notification -> OK
iOS app -> start -> OK
iOs app stop -> send notification -> click on notification -> **KO**

We tried to set up a breakpoint on Xcode but ended up nowhere.

I suspect this is due to a fatal bug in react-native-firebase 🔥iOS firebase.notifications().getInitialNotification() on notification tap the app opens then exit unexpected · Issue #1844 · invertase/react-native-firebase · GitHub

Hi @bacon,

We found this one too then tried one signal react native lib https://github.com/geektimecoil/react-native-onesignal on a freshly ejected Expo app and we experienced the same behavior.

Crash on start.

We are wondering if this is not because Expokit handles the notification first or something alike. Sometimes Xcode catches the exception on this area of the code.

https://github.com/expo/expo/pull/3431/files This fixed it!