skip to Main Content

There are A(from) -> B -> C -> D(to) sreens.

I wanna navigate to B from D in specific situation.

I tried to send navigation parameters B to C to D.

and submit action occurred from D, navigate to B using the navigation parameters.

But, I think it is not the best way.

Are there any better way to navigate backward?

2

Answers


  1. import { StackActions } from ‘@react-navigation/native’;

    navigation.dispatch(StackActions.replace(‘B’)

    Login or Signup to reply.
  2. you can just use:

    navigation.navigate('B')
    

    Then the navigation will back to B for you, or you can use this code:

    navigation.pop()
    navigation.pop()
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search