前言
前段时间一直在忙公司项目里的东西,有一段时间没有写文章分享了。最近想起之前看过的ReactNative
,现在打算整理出来,以供大家配置的时候可以看看,和我自己用来温故而知新!
以下为配置到ios项目,然后增加热更新,然后发布:
iOS原有项目中配置ReactNative
iOS原有项目中添加热更新(方式一pushy:react-native-update)
iOS原有项目中添加热更新(方式二CodePush:react-native-code-push)
ReactNative热更新发布应用(方式一pushy:react-native-update)
ReactNative热更新发布应用(方式二CodePush:react-native-code-push)
配置环境
1 . 安装HomeBrew
:在终端输入
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2 . 使用HomeBrew来安装Node.js
:
brew install node
3 . 安装完node后建议设置npm镜像以加速后面的过程(或使用科学上网工具)。注意:不要使用cnpm!cnpm安装的模块路径比较奇怪,packager不能正常识别!
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
4 . Yarn、React Native的命令行工具(react-native-cli)
npm install -g yarn react-native-cli
安装完yarn后同理也要设置镜像源:
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
5 . 推荐安装Watchman
brew install watchman
6 . 推荐安装Flow
brew install flow
参考网址:
http://reactnative.cn/docs/0.48/getting-started.html#content
网友评论