ReactNative安装和使用
2016-03-14 18:45
639 查看
可以先参考 http://zhuanlan.zhihu.com/FrontendMagazine/19996445 这篇文章1.本地下载有Xcode工具,到git 上 https://github.com/facebook/react-native 克隆仓库,或者下载一个zip 压缩包文件2.https://nodejs.org/en/ 下载nodejs 安装3.使用Homebrew 官网提供的指引安装Homebrew http://brew.sh/ 4.安装好Homebrew然后在终端执行以下命令
brew install node
5.接下来使用Homebrew 安装 watchman
brew install watchman6.使用 npm 安装React Native CLI 工具
npm install -g react-native-cli这步安装出错时,前面加上 sudo 即可
7.使用CLI 工具构建项目
react-native init PropertyFinder开始编写前先下载 SublimeText ,找到创建的工程目录下的 index.ios.js 文件用Sublime Text打开,清除里面所有内容开始写一个输出 Hello World !'use strict';var React = require('react-native');var styles = React.StyleSheet.create({text:{color: 'black',backgroundColor: 'white',fontSize: 30,margin: 80}});class AwesomeProjectApp extends React.Component{render(){return React.createElement(React.Text,{style:styles.text},"Hello World!");}}React.AppRegistry.registerComponent('AwesomeProject',function(){return AwesomeProjectApp});编写完成记得保存,运行工程就可以看到界面上显示的 Hello World
相关文章推荐
- react native 学习资料汇总
- React.render和reactDom.render的区别
- React框架
- [转] What is the point of redux when using react?
- React + ES6 实践中遇到的问题
- ReactiveCocoa
- ReactJS实用技巧(2):从新人大坑——表单组件来看State
- React.render和reactDom.render的区别
- React Native for android 项目驱动教程
- React-Native 自述
- Reactor
- ReactNative入门(安卓)——API(下)
- (记录向)reactjs学习记录
- react-native 学习中网站及博客
- react-js demo 地址
- react.js-12-promise
- react.js-10-渐隐动画
- react.js-09-输入刷新界面
- react.js-09-点击刷新state
- react.js-08-state