react-navigation4.0.10集成入坑
背景:给已有项目集成react-navigation。
已有项目环境:
"react": "16.9.0",
"react-native": "^0.61.5"
运行环境:iPhone 11 Pro Max -- 13.3。
步骤:
1. yarn add react-navigation
2. yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context
3. cd ios && pod install
官网说0.60以上链接是自动的,其实发现并不是这样的。运行后先是_RNGestureHandlerModule报错。
它的解决办法是:在Podfile中加入:pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
再run,接着报错"RNCSafeAreaView",
解决解决办法是:react-native link react-native-safe-area-context,这回生效了,有看到。然后执行Pod install,再run,跑起来了!
网友评论