Skip to content

Commit

Permalink
Fix isTransitioning on nested navigate (react-navigation#4520)
Browse files Browse the repository at this point in the history
This bug wasnt apparent until we fixed the transitioner to fully respect isTransitioning. The router did not handle this properly until now.

Enhanced a test to verify this in the future
  • Loading branch information
ericvicenti authored and brentvatne committed Jun 20, 2018
1 parent e1df2c6 commit aebe8a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/routers/StackRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ export default (routeConfigs, stackConfig = {}) => {
routeName: childRouterName,
key: action.key || generateKey(),
};
return StateUtils.push(state, route);
return {
...StateUtils.push(state, route),
isTransitioning: action.immediate !== true,
};
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/routers/__tests__/StackRouter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ describe('StackRouter', () => {
state
);

expect(state2.isTransitioning).toEqual(true);
expect(state2.index).toEqual(1);
expect(state2.routes[1].index).toEqual(1);
expect(state2.routes[1].routes[1].index).toEqual(1);
Expand Down

0 comments on commit aebe8a5

Please sign in to comment.