配置相关环境,点击下面两个网址,打开终端,按要求安装要下面4个环境:
官网:https://facebook.github.io/react-native/docs/getting-started.html#content
中文网:http://reactnative.cn/docs/0.24/getting-started.html#content
这里仅列出了OS X操作系统的环境安装, window的可以自己查看上面给出网址里有.
重要安装命令如下:
1.安装homebrew,在终端输入:
/usr/bin/ruby -e "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安装watchman:(监测文件变化的工具)
brew install --HEAD watchman
3.安装node:
brew install node
4.安装flow:(监测CSS语法的工具)
brew install flow
之后是安装ReactNative:
5.安装ReactNative:
npm install -g react-native-cli
6.初始化应用:
react-native init ReactNative_1 (你需要的工程名)
7.运行应用:(这里假设你已安装了Xcode,有simulator虚拟机)
react-native run-ios
到此环境已经搭建完毕,可以运行ReactNative程序了