您的位置:首页 > Web前端 > React

【Facebook的UI开发框架React入门之二】开发环境搭建(iOS平台)-goodmao

2015-06-05 16:40 351 查看
参考:

https://facebook.github.io/react-native/docs/getting-started.html

https://facebook.github.io/react-native/docs/tutorial.html#content

最新版本的React库源码:react-native v0.5

https://github.com/facebook/react-native/releases/tag/v0.5.0-rc

---------------------------------------------------------------------------------------------------

React.native是facebook开源的一套基于JavaScript的开源框架,
很方便用来开发移动设备的app。

而且,方便及时更新app的UI与数据,也很方便部署。
goodmao希望帮助大家迅速上手掌握!

---------------------------------------------------------------------------------------------------

一、环境要求

1.系统环境

需要Mac OS X + iOS7以上版本

2.IDE

Xcode6.3或以上版本:https://developer.apple.com/xcode/downloads/

3.安装服务器工具软件

Homebrew工具软件:https://github.com/Homebrew/homebrew

它用于安装以下软件:node,npm,watchman和flow。

终端命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


3.1.node

是Node.js的服务器环境,安装后,可以支持Node.js。

终端命令:brew install node

说明:JS是脚本语言,脚本语言都需要一个解析器才能运行。

对于写在HTML页面里的JS,浏览器充当了解析器的角色;

而对于需要独立运行的JS,NodeJS就是一个解析器。

3.2.npm

在安装node的时候,自动安装。

3.2.watchman(可选)

是来自Facebook 的观察程序。

网址:https://facebook.github.io/watchman/

作用:能观察和记录文件的变化,能够在相关的文件发生变化时触发一些动作,例如重新编译项目时。

终端命令:brew install watchman

3.3.flow(可选)

网址:http://flowtype.org/docs/about-flow.html

作用:是一个JavaScript的静态检查工具。

它能发现JavaScript程序中常见的bug。

终端命令:brew update

brew install flow

4.安装React-Native库

终端命令:npm install -g react-native-cli

5.创建基于React的iOS项目

项目名称:HelloReact

终端命令:react-native init HelloReact

6.Xcode编译运行项目

用Xcode打开项目:HelloReact

效果:在模拟器或iOS设备,可以见到提示字符串内容。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: