Handling Push Notifications


#1

I want to show a modal containing the notification data when the app is running(foreground).
In my RootNavigator i have a method attached to the Notification Subscription which sets the state of the hasNotification then i render based on the state of the hasNotification state.

render() {
    return this.state.hasNotification ? (
      this._displayModalForNotification()
    ) : (
      <AppNavigator />
    );
  }

However, this redirects the user to the RootScreen after receiving the notification.
What am i doing wrong.


#2

@norris1z hi! Welcome to Expo and thanks for the question.

If I understand your intent correctly. Your current code should not unmount AppNavigator. For a modal you can just render it nested in another view.

This documentation should be able to help you: https://reactnavigation.org/docs/en/custom-navigators.html#createnavigator


closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.