iOS集成ReactNavite

Mac-React Native 环境搭建

2017-03-27  本文已影响45人  精神病患者link常

1、安装xcode
2、安装Node.js
官网:https://nodejs.org
安装最新版即可
3、安装Homebrew
打开终端输入:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

4、安装 watchman 和 flow

brew install watchman
brew install flow

5、安装React Native 命令行工具

npm install -g react-native-cli

如果看到有错误:permission denied, 请在命令前面加上sudo 比如:

 sudo npm install -g react-native-cli

6、ReactNative 代码智能提醒 安装

git clone https://github.com/virtoolswebplayer/ReactNative-LiveTemplate

使用方法一

file -> import settings -> ReactNative.jar

使用方法二

Mac下安装
将ReactNative.xml复制到 ~/Library/Preferences/WebStorm11/templates
重启 WebStrom

-------------------------------------------------------分割线-------------------------------------------------------

warning 1

Looks like you installed react-native globally, maybe you meant react-native-cli?  
To fix the issue, run:  
npm uninstall -g react-native  
npm install -g react-native-cli 

按照提示

npm uninstall -g react-native  
npm install -g react-native-cli 

warning 2

xcrun: error: unable to find utility "instruments", not a developer tool or in PATH

终端输入

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

学习资料:

入门课程:推荐网站如下
1 ES6语法
http://es6.ruanyifeng.com

2 React
https://facebook.github.io/react/
http://www.ruanyifeng.com/blog/2015/03/react.html 阮一峰React入门实例

3 类似于MVC的架构
http://redux.js.org

http://www.ruanyifeng.com/blog/2016/09/redux_tutorial_part_one_basic_usages.html

http://www.ruanyifeng.com/blog/2016/09/redux_tutorial_part_two_async_operations.html

http://www.ruanyifeng.com/blog/2016/09/redux_tutorial_part_three_react-redux.html

4 不可变js
https://facebook.github.io/immutable-js/docs/#/Map

5 视图层
https://facebook.github.io/react-native/

视频学习
http://www.imooc.com/course/list?c=Reactjs

上一篇 下一篇

猜你喜欢

热点阅读