Noticed that there is an issue with NavigationStateUtils.push method. In the original react-native version you will notice that it uses invariant check for indexOf(state, route.key) === -1:
function push(state: NavigationState, route: NavigationRoute): NavigationState {
invariant(
indexOf(state, route.key) === -1,
'should not push route with duplicated key %s',
route.key,
);
...
}
Where as the react-native-mock version throws an error if indexOf(state, route.key) === -1 is true:
function push(state, route) {
if (indexOf(state, route.key) === -1) {
throw new Error('should not push route with duplicated key ' + route.key);
}
...
}
Noticed that there is an issue with
NavigationStateUtils.push
method. In the original react-native version you will notice that it usesinvariant
check forindexOf(state, route.key) === -1
:Where as the react-native-mock version throws an error if
indexOf(state, route.key) === -1
istrue
:Invariant throws an error for falsy values (https://github.com/zertosh/invariant#invariantcondition-message). Therefore the above should be:
indexOf(state, route.key) !== -1