React Native环境搭建(ios)

来源:互联网 发布:安装mac os 编辑:程序博客网 时间:2024/06/07 04:49

因为博主公司方案给定的React Native开发框架,近期自己开始了这个框架的学习之旅,就目前自己的感觉,这个框架真是强大的离谱啊,不说了,开干。


第一步,React Native框架基本了解及环境配置

React Native 是 Facebook 推出的一个用 Java 语言就能同时编写 ios,android,以及后台的一项技术,用这一门技术,它可以做到实时热更新.

React Native用iOS自带的JavaScriptCore作为JS的解析引擎,但并没有用到JavaScriptCore提供的一些可以让JS与OC互调的特性,而是自己实现了一套机制,这套机制可以通用于所有JS引擎上,在没有JavaScriptCore的情况下也可以用webview代替

第二步,环境搭建(本人IOS出身,只说mac端)

1.安装Homebrew

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

brew -v 检查是否安装成功

2.安装npm 和node.js

下载node.js安装即可https://nodejs.org/en/download/

3.安装watchMan(辅助开发工具,非必要安装)

brew install watchman

wangxiaoshengdeMacBook-Air:~ mac$ brew install watchman

Error: Another active Homebrew process is already in progress.

Please wait for it to finish or terminate it to continue.

==>Installing dependencies for watchman:pcre

==>Installing watchman dependency:pcre

==>Downloading https://homebrew.bintray.com/bottles/pcre-8.39.yosemite.bottle.t

######################################################################## 100.0%

==>Pouring pcre-8.39.yosemite.bottle.tar.gz

��  /usr/local/Cellar/pcre/8.39: 203 files, 5.4M

==>Installingwatchman

==>Downloading https://homebrew.bintray.com/bottles/watchman-4.7.0.yosemite.bot

######################################################################## 100.0%

==>Pouring watchman-4.7.0.yosemite.bottle.tar.gz

==>Using the sandbox

��  /usr/local/Cellar/watchman/4.7.0: 21 files, 428.8K

4.安装flow,是一个javascript的静态类型检查器,建议安装,方便找出代码中可能存在的类型错误

wangxiaoshengdeMacBook-Air:~ mac$ brew install flow

Error: Another active Homebrew process is already in progress.

Please wait for it to finish or terminate it to continue.

==>Downloading https://homebrew.bintray.com/bottles/flow-0.33.0.yosemite.bottle

######################################################################## 100.0%

==>Pouring flow-0.33.0.yosemite.bottle.tar.gz

==>Caveats

Bash completion has been installed to:

  /usr/local/etc/bash_completion.d


zsh completion has been installed to:

  /usr/local/share/zsh/site-functions

==>Summary

��  /usr/local/Cellar/flow/0.33.0: 7 files, 4.9M


第二步:React Native 安装

sudo npm install -g react-native-cli

wangxiaoshengdeMacBook-Air:~ mac$ sudo npm install -g react-native-cli

/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js

react-native-cli@1.0.0 /usr/local/lib/node_modules/react-native-cli

├── semver@5.3.0

├── minimist@1.2.0

├── chalk@1.1.3 (supports-color@2.0.0, ansi-styles@2.2.1, escape-string-regexp@1.0.5, has-ansi@2.0.0, strip-ansi@3.0.1)

└── prompt@0.2.14 (revalidator@0.1.8, pkginfo@0.4.0, read@1.0.7, winston@0.8.3, utile@0.2.1)

wangxiaoshengdeMacBook-Air:~ mac$ ZZ

wangxiaoshengdeMacBook-Air:~ mac$ sudo npm install -g react-native-cli

Password:

/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js

react-native-cli@1.0.0 /usr/local/lib/node_modules/react-native-cli

├── semver@5.3.0

├── minimist@1.2.0

├── chalk@1.1.3 (ansi-styles@2.2.1, escape-string-regexp@1.0.5, supports-color@2.0.0, strip-ansi@3.0.1, has-ansi@2.0.0)

└── prompt@0.2.14 (revalidator@0.1.8, pkginfo@0.4.0, winston@0.8.3, read@1.0.7, utile@0.2.1)


安装成功会有以上提示.








0 0
原创粉丝点击