Closed kylegillen closed 6 years ago
I have the same problem... Any news?
I have the same problem too... Any news?
@nextriot and @andreaPortfolio what version of react-navigation and react-navigation-redux-helpers are you using?
The react-navigation ReduxExample, which runs, uses the following versions:
react-navigation: 2.0.0-alpha.5 react-navigation-redux-helpers: ^1.0.0
I'm using: "react-native": "0.52.0", "react-navigation": "^1.5.1", "react-navigation-redux-helpers": "^1.0.3"
@nextriot and @andreaPortfolio do you have nested navigators, and is the SwitchNavigator the root navigator?
A quick fix is to set initialNavState
to null
here: ReduxExample/src/reducers/index.js#L10
@mattvick, thanks for helping.
Please check the snack (https://snack.expo.io/Hy643mQtz) for any further questions.
The SwitchNavigator is the root, and it has nested StackNavigators.
"react-navigation": "^1.5.1". "react-navigation-redux-helpers": "^1.0.3".
I don't think 2.0.0-alpha.5 is publicly available. So I don't think that's the issue.
@nextriot take a look at https://snack.expo.io/ByL0C9YFz it runs after setting const initialState = null
. Can anyone explain what the side effects of setting the initial state to null
might be?
I changed my reducer initial state from:
const initialState = AppNavigator.router.getStateForAction( AppNavigator.router.getActionForPathAndParams("AuthLoading") ); to
const initialState = null;
and now it works!!!
Thank you @mattvick
No worries @andreaPortfolio. Glad I could help.
I've read several blog posts on the subject, but would be great if there was some clear documentation outlining how to set initialState
for nested navigators.
Also I'd like to know why the navigation state has to be set in the app and as initialState
, which seems like setting the same thing in two places.
This need some clarification. Just setting initialState to null as a solution kinda bugs my mind.
Install react-navigation@next to fix the issue :D
Is anybody still experiencing this issue?
Yes but i installed react-navigation@next and the issue was fixed in there
I think react-navigation-redux-helpers@1.0.6
should fix this issue for people who are still on react-navigation@1.x
. If anybody is still experiencing this issue let me know!
Hi.
I'm using the exact Redux Integration outlined in the guide found here: https://reactnavigation.org/docs/redux-integration.html
However, when I export a SwitchNavigator (with a StackNavigator as its initial route) as my default Navigator I'm met with the following error:
undefined is not an object (evaluating 'prevState.index')
Here is a Snack reproducing the bug: https://snack.expo.io/Hy643mQtz
Any help is much appreciated.