Getting started with react-native
It is open-source and maintained by Facebook.
Source: React Native website
Setup for Linux (Ubuntu)
1) Setup Node.JS
Start the terminal and run the following commands to install nodeJS:
If node command is unavailable
Alternatives NodeJS instalations:
check if you have the current version
Run the npm to install the react-native
2) Setup Java
3) Setup Android Studio:
Android SDK or Android Studio
Android SDK e ENV
4) Setup emulator:
On the terminal run the command
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
Example app init
Obs: Always check if the version on
android/app/build.gradle is the same as the Build Tools downloaded on your android SDK
6) Run the project
Open Android AVD to set up a virtual android. Execute the command line:
Follow the instructions to create a virtual device and start it
Open another terminal and run the command lines:
Setup for Mac
Installing package manager Homebrew
Paste that at a Terminal prompt.
Installing Xcode IDE
Download it using link below or find it on Mac App Store
NOTE: If you have Xcode-beta.app installed along with production version of Xcode.app, make sure you are using production version of
xcodebuildtool. You can set it with:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
Installing Android environment
*If you have installed XCode, Git is already installed, otherwise run the following
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.
Ensure the 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:
If you installed the SDK without Android Studio, then it may be something like: /usr/local/opt/android-sdk
Dependencies for Mac
You will need Xcode for iOS and Android Studio for android, node.js, the React Native command line tools, and Watchman.
We recommend installing node and watchman via Homebrew.
Watchman is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance. It is optional.
Node comes with npm, which lets you install the React Native command line interface.
If you get a permission error, try with sudo:
For iOS the easiest way to install Xcode is via the Mac App Store. And for android download and install Android Studio.
If you plan to make changes in Java code, we recommend Gradle Daemon which speeds up the build.
Testing your React Native Installation
Use the React Native command line tools to generate a new React Native project called "AwesomeProject", then run react-native run-ios inside the newly created folder.
You should see your new app running in the iOS Simulator shortly. react-native run-ios is just one way to run your app - you can also run it directly from within Xcode or Nuclide.
Modifying your app
Now that you have successfully run the app, let's modify it.
- Open index.ios.js or index.android.js in your text editor of choice and edit some lines.
- Hit Command⌘ + R in your iOS Simulator to reload the app and see your change! That's it!
Congratulations! You've successfully run and modified your first React Native app.
source: Getting Started - React-Native
Setup for Windows
Note: You cannot develop react-native apps for iOS on Windows, only react-native android apps.
- Windows 10
- command line tool (eg Powershell or windows command line)
- Chocolatey (steps to setup via PowerShell)
- The JDK (version 8)
- Android Studio
- An Intel machine with Virtualization technology enabled for HAXM (optional, only needed if you want to use an emulator)
1) Setup your machine for react native development
Start the command line as an administrator run the following commands:
Restart command line as an administrator so you can run npm
After running the last command copy the directory that react-native was installed in. You will need this for Step 4. I tried this on two computers in one case it was:
C:\Program Files (x86)\Nodist\v-x64\6.2.2. In the other it was:
2) Set your Environment Variables
Open the Environment Variables window by navigating to:
[Right click] "Start" menu -> System -> Advanced System Settings -> Environment Variables
In the bottom section find the "Path" System Variable and add the location that react-native was installed to in step 1.
If you haven't added an ANDROID_HOME environment variable you will have to do that here too. While still in the "Environment Variables" window, add a new System Variable with the name "ANDROID_HOME" and value as the path to your android sdk.
Then restart the command line as an admin so you can run react-native commands in it.
3) Create your project In command line, navigate to the folder you want to place your project and run the following command:
4) Run your project Start an emulator from android studio Navigate to the root directory of your project in command line and run it:
You may run into dependency issues. For example, there may be an error that you do not have the correct build tools version. To fix this you will have to open the sdk manager in Android Studio and download the build tools from there.
To refresh the ui you can press the
r key twice while in the emulator and running the app. To see developer options you can press
ctrl + m.