ReactNative从零开始笔记-常见问题(持续更新中)

一、使用环境

  • Mac 电脑 系统10.14.2
  • Xcode9.4
  • react-native-cli版本 2.0.1
  • react-native: 0.57.3
  • webstorm

二、常见问题

1、运行react-native 项目 模拟报错
ReactNative从零开始笔记-常见问题(持续更新中)_第1张图片
image.png

解决办法: 执行命令

npm install --build-from-source
2、使用系统导航报错

Navigator is deprecated and has been removed from this package. It can now be installed

ReactNative从零开始笔记-常见问题(持续更新中)_第2张图片
image.png

原因:从0.44版本开始,Navigator被从react native的核心组件库中剥离到了一个名为react-native-deprecated-custom-components的单独模块中,而且官方推荐使用React Navigation导航组件,这个已经默认为官方推荐了

解决办法:安装组件 执行命令

npm install react-native-deprecated-custom-components  --save
3 、Invariant Violation: Text strings must be rendered within a component
ReactNative从零开始笔记-常见问题(持续更新中)_第3张图片
image.png
4. 运行报错 No bundle URL present
ReactNative从零开始笔记-常见问题(持续更新中)_第4张图片
image.png

解决办法:

  1. 关闭模拟器,完全对退出模拟器
  2. 重新运行react-native run-ios

你可能感兴趣的:(ReactNative从零开始笔记-常见问题(持续更新中))