Standalone app crashes when I tap on notification (only when app is completely closed)

Please provide the following:

  1. SDK Version: 41
  2. Platforms(Android/iOS/web/all): all
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I’m having an issue with standalone apps, I’m trying to navigate the user after tapping on a notification that was sent to the device and everything works except when app is completely closed it crashes.

here is my code snippet for setting up notis:

**  const lastNotificationResponse = Notifications.useLastNotificationResponse();

   useEffect(() => {
      if (
         lastNotificationResponse &&
         lastNotificationResponse.notification.request.content.data &&
         lastNotificationResponse.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER
      ) {
         if (lastNotificationResponse.notification.request.content.data.NotificationType === 'Escalation' || lastNotificationResponse.notification.request.content.data.NotificationType === 'Message') 
         {
            Navigation.navigate('RequestDetails', {
               id: lastNotificationResponse.notification.request.content.data.Identifier,
               number: 0,
               title: 'New Request',
               status: RequestStatus.New,
            });
         } 
         else {
            Navigation.navigate('Tabs', {
               screen: 'Home',
               params: { scheduleOpen: true },
            });
         }
      }}, [lastNotificationResponse])
**

under my navigation.navigate method I wait for the navigator isReadyRef to be ready before pushing so I know the issue is not with the navigator -

any suggestions?

1 Like

The issue was with the navigator not mounted yet,

Can you tell me what you did to fix this? How did you check that the navigator was mounted. Put your code and maybe the file where you did that? I have a similar problem.