react-native-android
Getting started
$ npm install react-native-android --save
Mostly automatic installation
$ react-native link react-native-android
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜ Add Files to [your project's name]
- Go to
node_modules
➜ react-native-android
and add RNAndroid.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNAndroid.a
to your project's Build Phases
➜ Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNAndroidPackage;
to the imports at the top of the file - Add
new RNAndroidPackage()
to the list returned by the getPackages()
method
- Append the following lines to
android/settings.gradle
:
include ':react-native-android'
project(':react-native-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:
compile project(':react-native-android')
Windows
Read it! :D
- In Visual Studio add the
RNAndroid.sln
in node_modules/react-native-android/windows/RNAndroid.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Android.RNAndroid;
to the usings at the top of the file - Add
new RNAndroidPackage()
to the List<IReactPackage>
returned by the Packages
method
Usage
import RNAndroid from 'react-native-android';
RNAndroid;