1.安装react-native-cli
npm install -g react-native-cli
2.初始化项目
react-native init 项目名
react-native命令行从npm官方源拖代码时会遇上麻烦。请将npm仓库源替换为国内镜像:
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
npm install -g react-native-cli
2.初始化项目
react-native init 项目名
react-native命令行从npm官方源拖代码时会遇上麻烦。请将npm仓库源替换为国内镜像:
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
3.react-native start
测试是否已经启动:http://localhost:8081/index.android.bundle?platform=android
4.react-native run-android
附加API地址:http://reactnative.cn/