Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
daviscabral committed May 20, 2018
1 parent fcbf77a commit 5eec2cb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,13 @@ export function reducer(state = navigationStore.state, action) {
let newState = state;
let currentState = state;
const initialState = navigationStore.router.getStateForAction(NavigationActions.popToTop(), currentState);
while (newState && nextScene !== routeName) {
while (newState && nextScene !== routeName && !isEqual(newState, initialState)) {
newState = navigationStore.router.getStateForAction(NavigationActions.back(), currentState);
if (newState) {
nextScene = getActiveState(newState).routeName;
if (nextScene !== routeName) {
currentState = newState;
}
if (isEqual(currentState, initialState)) {
break;
}
}
}
return nextScene === routeName ? newState : state;
Expand Down

0 comments on commit 5eec2cb

Please sign in to comment.