1. 安装React Native

参考http://reactnative.cn/docs/0.47/getting-started.html

一:安装

1.通过homebrew来安装
2.安装node:brew install node
3.node 安装完后,安装npm镜像

npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global

4.npm install 来安装React Native 命令行工具
这个命令npm install -g react-native-cli往下走在安装包会存在丢失包的情况 ;
用这个命令npm install -g yarn react-native-cli (通过yarn来安装)
接下来设置yarn镜像

yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global

5.通过 react-native --help来查看所支持的命名

二:运行

1.通过终端进入某个文件夹,然后通过命令react-native init FirstApp 或者加入版本react-native init FirstApp --version 1.0.0,这样就创建了一个 FirstApp
2.ios启动 ReactNative

进入FirstApp文件夹,执行react-native run-ios
或者 通过Xcode打开`ios`文件夹中的 `FirstApp.xcodeproj` 

3.android 启动ReactNative

进入FirstApp文件夹,执行react-native run-android
或者 通过 Android Studio 来打开`android` 文件夹

你可能感兴趣的:(1. 安装React Native)