First, the Environment configuration: (1). Installing the latest version of Xcode is recommended for XCode7.1 and above. PS: If it is not the latest version, it may be compiled after the new project. The small part is not before the upgrade to the latest version of Xcode, and then a compilation problem plagued by a long time. ) (2). Install Homeblew (an installation package Manager on an OS system that can be installed after installation to facilitate subsequent installation of the package.) ) Terminal command:
Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
(3). Install node. JS (server-side JavaScript runtime Environment): https://nodejs.org/download/After successful installation, the terminal will have the following message:
node. JS is installed at:/usr/local/bin/node NPM is installed at:/USR/LOCAL/BIN/NPM? Make sure That/usr/local/bin are in your $PATH.
(4). It is recommended to install Watchman (react a tool to modify the source file) Terminal command:
Brew Install Watchman
(5). Install Flow: A JavaScript static type checker. Terminal command:
Brew Install Flow
(6). Install React Native CLI: command-line tool Terminal command for developing react Native:
sudo npm install-g react-native
Install the environment, you can play happily. Or you can do this:
- Brew Install NVM (NVM is a little faster than NPM, but I don't feel it, it's basically the same way NPM uses)
- Brew Install Watchman (react a tool to modify the source file)
- Brew Install flow (type checker for JS scripts)
- sudo npm install-g react-native-cli (Start installing react-native)
Basic use of react-native
- React-native Init myApp (creating a project called Mympp, takes a long time, but may also be the reason for the speed, where it will generate a node_mobiles directory in the parallel directory of MYAPP, there will be a lot of supporting files, Don't change it.
- CD myApp (cut into the project directory)
- React-native Run-android (running Android)
React-native will generate Android and iOS directly, so you don't need to add a platform.
React-native Getting Started