From 9fe54641c499bbbbb74b1a617d660d08d8da111b Mon Sep 17 00:00:00 2001
From: Website Deployment Script Homebrew, in order to install the required NodeJS, in addition to some
-recommended installs. We recommend periodically running Use Homebrew to install Node.js. NodeJS 4.0 or greater is required for React Native. The default Homebrew package for Node is
+recommended installs. Use Homebrew to install Node.js. NodeJS 4.0 or greater is required for React Native. The default Homebrew package for Node is
currently 6.0, so that is not an issue. The React Native command line tools allow you to easily create and initialize projects, etc. If you see the error, Xcode 7.0 or higher. Open the App Store or go to https://developer.apple.com/xcode/downloads/. This will also install Xcode 7.0 or higher. Open the App Store or go to https://developer.apple.com/xcode/downloads/. This will also install Android Studio 2.0 or higher. This will provide you
-the Android SDK and emulator required to run and test your React Native apps. Android Studio requires the Java Development Kit [JDK] 1.8 or higher. You can type
+ Android Studio 2.0 or higher. Android Studio requires the Java Development Kit [JDK] 1.8 or higher. You can type
You will need to customize your installation: Ensure the Android Studio will provide you the Android SDK and emulator required to run and test your React
+Native apps. Unless otherwise mentioned, keep all the setup defaults intact. For example, the
+ You will need to customize your installation: Ensure the Unsupported #


Installation #
Required Prerequisites #
Homebrew #
brew update && brew upgrade to keep your programs up-to-date.Node #
Node #
React Native Command Line Tools #
EACCES: permission denied, please run the command:
sudo npm install -g react-native-cli.XCode #
git as well.Xcode #
git as well.Android Studio #
Android Studio #
javac -version to see what version you have, if any. If you do not meet the JDK requirement,
you can
-download it.Custom installation
Performance and Android Virtual Device
Configure | SDK Manager from the Android Studio welcome window.
SDK Platforms window, choose Show Package Details and under Android 6.0 (Marshmallow), make sure that Google APIs, Intel x86 Atom System Image, Intel x86 Atom_64 System Image, and Google APIs Intel x86 Atom_64 System Image are checked.
SDK Tools window, choose Show Package Details and under Android SDK Build Tools, make sure that Android SDK Build-Tools 23.0.1 is selected.
ANDROID_HOME Environment Variable #
ANDROID_HOME environment variable points to your existing Android SDK. To do that, add
+download it.Android Support Repository is installed automatically with Android Studio, and we need that
+for React Native.Custom installation
Performance and Android Virtual Device
Configure | SDK Manager from the Android Studio welcome window.
SDK Platforms window, choose Show Package Details and under Android 6.0 (Marshmallow), make sure that Google APIs, Intel x86 Atom System Image, Intel x86 Atom_64 System Image, and Google APIs Intel x86 Atom_64 System Image are checked.
SDK Tools window, choose Show Package Details and under Android SDK Build Tools, make sure that Android SDK Build-Tools 23.0.1 is selected.
ANDROID_HOME Environment Variable #
ANDROID_HOME environment variable points to your existing Android SDK. To do that, add
this to your ~/.bashrc, ~/.bash_profile (or whatever your shell uses) and re-open your terminal:
PATH #You can add the Android tools directory on your PATH in case you need to run any of the Android
tools from the command line such as android avd. In your ~/.bash or ~/.bash_profile:
Enable Gradle Daemon which greatly improves incremental build times for changes in java code.
Git version control. If you have installed XCode, Git is +export PATH
Enable Gradle Daemon which greatly improves incremental build times for changes in java code.
Git version control. If you have installed Xcode, Git is already installed, otherwise run the following:
[Nuclide] is an IDE from Facebook providing a first-class development environment for writing, -running and +
Nuclide is an IDE from Facebook providing a first-class development environment +for writing, running and debugging React Native applications.
Get started with Nuclide here.
Fire up the Termimal and use Chocolatey to install NodeJS.
The React Native command line tools allow you to easily create and initialize projects, etc.
If you see the error,
EACCES: permission denied, please run the command: -sudo npm install -g react-native-cli.
Android Studio 2.0 or higher. This will provide you -the Android SDK and emulator required to run and test your React Native apps.
Android Studio requires the Java Development Kit [JDK] 1.8 or higher. You can type +
sudo npm install -g react-native-cli.
Android Studio 2.0 or higher.
Android Studio requires the Java Development Kit [JDK] 1.8 or higher. You can type
javac -versionto see what version you have, if any. If you do not meet the JDK requirement, you can download it, or use a pacakage manager to install it (e.g.choco install jdk8, -apt-get install default-jdk).
apt-get install default-jdk).Android Studio will provide you the Android SDK and emulator required to run and test your React +Native apps.
Unless otherwise mentioned, keep all the setup defaults intact. For example, the +
Android Support Repositoryis installed automatically with Android Studio, and we need that +for React Native.
You will need to customize your installation:
Custom installation
Android Virtual Device
PATH #You can add the Android tools directory on your PATH in case you need to run any of the Android
tools from the command line such as android avd.
In your ~/.bash or ~/.bash_profile:
In your ~/.bashrc or ~/.bash_profile:
index.ios.js in your text editor of choice (e.g. Nuclide) and edit some lines.R key twice OR open the menu (F2 by default, or ⌘-M in Genymotion) and select Reload JS to see your change!adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your app's logsindex.android.js in your text editor of choice (e.g. Nuclide) and edit some lines.R key twice OR open the menu (F2 by default, or ⌘-M in Genymotion) and select Reload JS to see your change!adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your app's logsCongratulations! You've successfully run and modified your first React Native app.

Congratulations! You've successfully run and modified your first React Native app.

A common issue on Windows is that the packager is not started automatically when you run +
A common issue is that the packager is not started automatically when you run
react-native run-android. You can start it manually using:
Or if you hit a ERROR Watcher took too long to load on Windows, try increasing the timeout in this file (under your node_modules/react-native/).
Now that you successfully started the project, let's modify it:
R key twice OR open the menu (F2 by default, or ⌘-M in Genymotion) and select Reload JS to see your change!adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your app's logsCongratulations! You've successfully run and modified your first React Native app.

Or if you hit a ERROR Watcher took too long to load on Windows, try increasing the timeout in this file (under your node_modules/react-native/).
Now that you successfully started the project, let's modify it:
index.android.js in your text editor of choice (e.g. Nuclide) and edit some lines.R key twice OR open the menu (F2 by default, or ctrl-M in the emulator) and select Reload JS to see your change!adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your app's logsCongratulations! You've successfully run and modified your first React Native app.

JavaScript Environment # | Edit on GitHub |
When using React Native, you're going to be running your JavaScript code in two environments:
While both environments are very similar, you may end up hitting some inconsistencies. We're likely going to experiment with other JS engines in the future, so it's best to avoid relying on specifics of any runtime.
Syntax transformers make writing code more enjoyable by allowing you to use new JavaScript syntax without having to wait for support on all interpreters.
As of version 0.5.0, React Native ships with the Babel JavaScript compiler. Check Babel documentation on its supported transformations for more details.
Here's a full list of React Native's enabled transformations.
ES5
promise.catch(function() { });ES6
<C onPress={() => this.setState({pressed: true})}let greeting = 'hi';Math.max(...array);class C extends React.Component { render() { return <View />; } }const answer = 42;var {isActive, style} = this.props;for (var num of [1, 2, 3]) {}import React, { Component } from 'react';var key = 'abc'; var obj = {[key]: 10};var obj = { method() { return 10; } };var name = 'vjeux'; var obj = { name };function(type, ...args) { }var who = 'world'; var str = `Hello ${who}`;ES7
var extended = { ...obj, a: 10 };function f(a, b, c,) { }async function doStuffAsync() { const foo = await doOtherStuffAsync(); };Specific
Many standards functions are also available on all the supported JavaScript runtimes.
Browser
ES6
ES7
Specific
__DEV__JavaScript Environment # | Edit on GitHub |
When using React Native, you're going to be running your JavaScript code in two environments:
While both environments are very similar, you may end up hitting some inconsistencies. We're likely going to experiment with other JS engines in the future, so it's best to avoid relying on specifics of any runtime.
Syntax transformers make writing code more enjoyable by allowing you to use new JavaScript syntax without having to wait for support on all interpreters.
As of version 0.5.0, React Native ships with the Babel JavaScript compiler. Check Babel documentation on its supported transformations for more details.
Here's a full list of React Native's enabled transformations.
ES5
promise.catch(function() { });ES6
<C onPress={() => this.setState({pressed: true})}let greeting = 'hi';Math.max(...array);class C extends React.Component { render() { return <View />; } }const answer = 42;var {isActive, style} = this.props;for (var num of [1, 2, 3]) {}import React, { Component } from 'react';var key = 'abc'; var obj = {[key]: 10};var obj = { method() { return 10; } };var name = 'vjeux'; var obj = { name };function(type, ...args) { }var who = 'world'; var str = `Hello ${who}`;ES7
var extended = { ...obj, a: 10 };function f(a, b, c,) { }async function doStuffAsync() { const foo = await doOtherStuffAsync(); };Specific
Many standards functions are also available on all the supported JavaScript runtimes.
Browser
ES6
ES7
Specific
__DEV__