React Native lets you build mobile apps using only JavaScript. It uses the same design as React, letting you compose a rich mobile UI from declarative components.
With React Native, you don't build a “mobile web app”, an “HTML5 app”, or a “hybrid app”. You build a real mobile app that's indistinguishable from an app built using Objective-C or Java. React Native uses the same fundamental UI building blocks as regular iOS and Android apps. You just put those building blocks together using JavaScript and React.
It is open-source and maintained by Facebook.
Source: React Native website
1) Setup Node.JS
curl -sL http://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
curl -sL http://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
or
curl -sL http://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
sudo npm install -g react-native-cli
2) Setup Java
sudo apt-get install lib32stdc++6 lib32z1 openjdk-7-jdk
3) Setup Android Studio:
http://developer.android.com/sdk/index.html
export ANDROID_HOME=/YOUR/LOCAL/ANDROID/SDK
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
4) Setup emulator:
On the terminal run the command
android
Select "SDK Platforms" from within the SDK Manager and you should see a blue checkmark next to "Android 7.0 (Nougat)". In case it is not, click on the checkbox and then "Apply".
5) Start a project
react-native init ReactNativeDemo && cd ReactNativeDemo
android/app/build.gradle
is the same as the Build Tools downloaded on your android SDKandroid {
compileSdkVersion XX
buildToolsVersion "XX.X.X"
...
6) Run the project
android avd
Follow the instructions to create a virtual device and start it
Open another terminal and run the command lines:
react-native run-android
react-native start
Installing package manager Homebrew brew
Paste that at a Terminal prompt.
/usr/bin/ruby -e "$(curl -fsSL http://raw.githubusercontent.com/Homebrew/install/master/install)"
Installing Xcode IDE
Download it using link below or find it on Mac App Store
http://developer.apple.com/download/
NOTE: If you have Xcode-beta.app installed along with production version of Xcode.app, make sure you are using production version of
xcodebuild
tool. You can set it with:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
Installing Android environment
Git git
*If you have installed XCode, Git is already installed, otherwise run the following
brew install git
Choose a Custom installation
Choose both Performance and Android Virtual Device
After installation, choose Configure -> SDK Manager from the Android Studio welcome window.
In the 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.
In the 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.