React Native - Stack Navigator, close multiple views

I am trying to close multiple views in Stack Navigator without ugly animation. The application structure looks like this:

Tab navigator:

  • Screen 1
  • Screen 2
  • Screen 3

StackNavigator:

  • Tab navigator (route name: Home) => Registration type => Entry type

Figure 2 shows a button that opens the registration view in the Stack Navigator, and from the registration window, you can open the login window.

When I login, I want to dismiss the registration and registration view and return to Screen 2 using just one animation.

I've tried with this:

NavigationActions.reset({
    index: 0,
    actions: [
        NavigationActions.navigate({ routeName: 'Home' }),
    ],
})

      

as I saw in a similar question, but this is not the expected behavior. With this code, we can see how the two views (login and registration) fire the animation sequentially and the Tab Navigator returns to screen 1.

I've tried with too NavigationsActions.back

, but nothing happens when I set the parameter ({key: 'Home'})

(I've tried using Home, RegistrationView and the "key" value found in the navigatorState routes).

How can I make it right? Hope you can help me, thanks.

+3
react-native react-navigation


source to share


No one has answered this question yet

Check out similar questions:

36
Resetting the navigation stack for the main screen (React Navigation and React Native)
4
Reset TabNavigator history with navigation reaction
4
Reset the built-in Navigator stack stack
2
Feedback
2
how can I reset the navigation of a React Native app to the current React Navigation screen
1
Get the currently active route screen of the navigator tab in responsive navigation
0
React Navigator and React Native Interactable libraries
0
React Navigation parameter not reset
0
React-Navigation drawer takes me back to the previous screen right after the element is displayed
0
Stack Navigator thread error with TabRouter



All Articles
Loading...
X
Show
Funny
Dev
Pics