ReactNative问题记录
环境:
1、Warning: Provider: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.
解决: mobx-react升级到5.2.8+. 参考链接
2、 undefined is not an object (evaluating 'RNGestureHandlerModule.State')
remove node_modules and package-lock.json
npm install
npm install --save react-navigation
npm install --save react-native-gesture-handler
react-native link
3、require cycle node_modules/react-native-native-gesture-handle/index.js
github上面已解决,等待发布新版本react-native-native-gesture-handle
4、android第三方模拟器Genymotion
注册下载安装genymotion,登录账号,安装版本,adb devices 显示可用模拟器不为空后,即可正常编译运行, 无需在android studio中下载插件
5、使用装饰器
babel 7 以上,需要使用
"@babel/plugin-proposal-decorators" 代替 "babel-plugin-transform-decorators-legacy"
6、自定义字体
package.json 中添加"rnpm": {"assets": ["./fonts"]}
xcode 中打开ios/ReactNativeDemo.xcodeproj -> 把字体文件移入根目录 -> Info.plist 添加一项
react-native link
7、react native使用mobx , can't find variable:Symbol
把mobx降版本到 4.3.1 . mobx-react降版本到 5.2.8 即可