Reset state instead of pushing new routes for navigation actions in Drawer (#3164)

This commit is contained in:
Nicolas Beck
2018-01-27 00:30:11 +01:00
parent 8650d48bbc
commit f3e4f49074

View File

@@ -62,9 +62,13 @@ class DrawerSidebar extends React.PureComponent {
let subAction;
// if the child screen is a StackRouter then always navigate to its first screen (see #1914)
if (route.index !== undefined && route.index !== 0) {
route = route;
subAction = NavigationActions.navigate({
routeName: route.routes[0].routeName,
subAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({
routeName: route.routes[0].routeName,
}),
],
});
}
this.props.navigation.navigate(route.routeName, undefined, subAction);