环境搭建
react-native目前只放出了ios版本,那为了体验,你必须有os x系统,并且安装了xcode.
另外官方推荐使用homebrew来安装nodejs,watchman,flow等相关工具.
安装homebrew:
1
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装完homebrew,我们分别安装nodejs,watchman,flow,分别输入如下命令:
1
2
3brew install node
brew install watchman
brew install flow安装 react-native本身
1
npm install -g react-native-cli
初始化一个工程
1
react-native init MyProject
开启环境
1
npm start
运行Xcode