mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 17:18:09 +00:00
Stack pushes are now idempotent
This commit is contained in:
parent
8d91753e9c
commit
528b1ad812
@ -72,6 +72,8 @@ export default (
|
||||
paths[routeName] = { re, keys, toPath: pathToRegexp.compile(pathPattern) };
|
||||
});
|
||||
|
||||
let inProgressNavigationRouteName = null;
|
||||
|
||||
return {
|
||||
getComponentForState(state: NavigationState): NavigationComponent {
|
||||
const activeChildRoute = state.routes[state.index];
|
||||
@ -138,6 +140,16 @@ export default (
|
||||
};
|
||||
}
|
||||
|
||||
// Check if action wants to route to the route that is in-progress navigating
|
||||
if (
|
||||
inProgressNavigationRouteName !== null &&
|
||||
inProgressNavigationRouteName === passedAction.routeName
|
||||
) {
|
||||
inProgressNavigationRouteName = null;
|
||||
return false;
|
||||
}
|
||||
inProgressNavigationRouteName = passedAction.routeName;
|
||||
|
||||
// Check if a child scene wants to handle the action as long as it is not a reset to the root stack
|
||||
if (action.type !== NavigationActions.RESET || action.key !== null) {
|
||||
const keyIndex = action.key
|
||||
|
Loading…
x
Reference in New Issue
Block a user