React Native react-navigation navigation.navigate.reset doesn’t work

React Native react-navigation navigation.navigate.reset doesn’t work

1. If you are using react-navigation version “1.0.0-beta.11” then kindly use the below code to reset navigation stack

const resetAction = NavigationActions.reset({
    index: 0,
    key: null,
    actions: [ NavigationActions.navigate({ routeName: 'Home' }) ],
  });
  navigation.dispatch(resetAction);

//Note key: null is very important here.

Reference: github post by react navigation contributor 
2. If you are using react-navigation(v2) version “2.0.0-rc.9” then kindly use the below code to reset navigation stack

const resetAction = StackActions.reset({
    index: 0,
    key: null,
    actions: [ NavigationActions.navigate({ routeName: 'DrawerStack' }) ],
  });
  navigation.dispatch(resetAction);

 

Read More On React-Navigation : Typical issues of react-navigation

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.