mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-10 09:13:43 +08:00
Reset state instead of pushing new routes for navigation actions in Drawer (#3164)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user