1、引入mobx,支持ES7 decorator的报错问题
安装以下包(yarn or npm)
yarn add module:metro-react-native-babel-preset @babel/preset-flow @babel/plugin-proposal-decorators --dev
创建 .babelrc文件
{
"presets": [
"module:metro-react-native-babel-preset",
"@babel/preset-flow"
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy" : true }]
]
}
2、使用导航栏组件react-navigation
,stackNavigator
报错
stackNavigator 因为涉及到客户端手势操作,
需导入react-native-gesture-handler
1. yarn add react-native-gesture-handler
2. react-native link react-native-gesture-handler
3. 查看iOS工程的Podfile文件是否引入
pod 'React', :path => '../node_modules/react-native', :subspecs => [
. . . // other subspecs
'RCTLinkingIOS',
. . .
]
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
4. 进行pod install
网友评论