[英]Navigation error with react native latest version 0.61.4
I upgraded my old project in react native version(0.61.4) then getting error related navigation option undefined.
Old project dependency version:-- "react": "16.8.3", "react-native": "0.59.5", "react-navigation": "1.0.0-beta.3", New Project dependency versions:-- "react": "16.9.0", "react-native": "0.61.4", "react-navigation": "^4.0.10", "react-navigation-stack": "^1.10.3", Note:-- I also tried with navigation version 2, 3. please help旧项目依赖版本:--“react”:“16.8.3”,“react-native”:“0.59.5”,“react-navigation”:“1.0.0-beta.3”,新项目依赖版本: -- “react”:“16.9.0”,“react-native”:“0.61.4”,“react-navigation”:“^4.0.10”,“react-navigation-stack”:“^1.10.3 ",注意:--我也试过导航版本2、3。请帮忙
I think the problem is the jump from react-navigation v1 to v4.我认为问题在于从 react-navigation v1 到 v4 的跳转。
Check the createNavigator
params检查
createNavigator
参数
In v4 you should have a navigationConfig param passed like this:在 v4 中,您应该像这样传递一个 navigationConfig 参数:
createNavigator(NavigationView, router, navigationConfig);
https://reactnavigation.org/docs/en/custom-navigators.html#createnavigator https://reactnavigation.org/docs/en/custom-navigators.html#createnavigator
If still not working probably you should check the breaking changes from here如果仍然无法正常工作,您应该从这里检查重大更改
https://reactnavigation.org/blog/2018/05/07/react-navigation-2.0.html https://reactnavigation.org/blog/2018/05/07/react-navigation-2.0.html
and also from v3 and v4.也来自 v3 和 v4。
Adding to Florin's answer, make sure you export wrap your root navigator with appContainer
.添加到弗洛林的答案,确保你导出包装你的根导航
appContainer
。
Docs: https://reactnavigation.org/docs/en/app-containers.html文档: https://reactnavigation.org/docs/en/app-containers.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.