Open nordved opened 7 years ago
I found the place where the current navigator is set after removing a navigator. If I remove the navigator to be removed from the navigatorsToRestore
array, then it (in my case) finds the right slidingTabNavigation to restore and set to current.
The console.log showed that before my edit the two navigatorUIDs were the same.
static [ActionTypes.REMOVE_NAVIGATOR](state, { navigatorUID }) {
navigatorsToRestore = _.without(navigatorsToRestore, navigatorUID) // remove the removee
const currentNavigatorUID = (navigatorsToRestore.length && navigatorsToRestore[navigatorsToRestore.length - 1]) ||
state.navigators[navigatorUID].parentNavigatorUID;
console.log(navigatorUID, currentNavigatorUID, navigatorsToRestore)
navigatorsToRestore.pop();
return {
...state,
currentNavigatorUID,
navigators: _.omit(state.navigators, navigatorUID),
};
}
This seems like a special case fix, it would be much nicer if slidingTabViews were restored when popping on the stack that they are on.
I'm having a similar issue, although I'm not using SlidingTabNavigation, I'm using TabNavigation. See https://github.com/exponent/ex-navigation/issues/433. Quite possible that the cause of your issue is the same as mine.
I have a setting where in one stack there are two SlidingTabNavigation navigators.
Home --> Sliding1 --> Sliding2 --> Item
When reaching the Item page, the routes of the stack navigator are all 3 scenes.Navigating back from the Item scene, the item is popped from the stack navigator's routes and the current navigator is the stack.
Navigating back from Sliding2 removes the Sliding2 navigator from the navigators and then sets it as the current navigator.
This means that navigating back again gives an error finding index of undefined.
EDIT: stacktrace