1

I am trying to do some deep linking so that when a user gets a push notification to go to their chat screen. I can get to the correct screen, though I was wondering if there is a good way to silently add other screens underneath.

The reason behind this is that our app has a structure where to get to the chat screen you have to have the home screen and then conversation screen and the chat and conversation screen both have a back button. Without the correct navigation stack the back button could get the user into a weird state.

2
  • To clarify... The user can click the notification to jump straight to the chat screen... Then from there the user can click back button to navigate backwards? Commented Jul 31, 2018 at 23:06
  • @SGhaleb correct Commented Jul 31, 2018 at 23:49

1 Answer 1

1

So after some digging for redux there is a reset function that you can call to reset and build the stack as you want. I was able to set the stack correctly by using the NavigationActions to build the new stack and index to point to the correct route.

import { NavigationActions } from 'react-navigation';

dispatch({
    index: 2,
    key: null,
    type: 'Navigation/RESET',
    actions: [
        NavigationActions.navigate({ routeName: 'PotentialMatches' }),
        NavigationActions.navigate({ routeName: 'Conversations' }),
        NavigationActions.navigate({ routeName: 'Chat' }),
    ],
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.