Fix isTransitioning on nested navigate (#4520)

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
This commit is contained in:
Eric Vicenti 2018-06-20 12:17:14 -07:00 committed by Brent Vatne
parent e1df2c6c4a
commit aebe8a5c23
2 changed files with 5 additions and 1 deletions

View File

@ -401,7 +401,10 @@ export default (routeConfigs, stackConfig = {}) => {
routeName: childRouterName, routeName: childRouterName,
key: action.key || generateKey(), key: action.key || generateKey(),
}; };
return StateUtils.push(state, route); return {
...StateUtils.push(state, route),
isTransitioning: action.immediate !== true,
};
} }
} }
} }

View File

@ -692,6 +692,7 @@ describe('StackRouter', () => {
state state
); );
expect(state2.isTransitioning).toEqual(true);
expect(state2.index).toEqual(1); expect(state2.index).toEqual(1);
expect(state2.routes[1].index).toEqual(1); expect(state2.routes[1].index).toEqual(1);
expect(state2.routes[1].routes[1].index).toEqual(1); expect(state2.routes[1].routes[1].index).toEqual(1);