Skip to content

Instantly share code, notes, and snippets.

@matthewshirley
Last active June 6, 2017 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewshirley/6fda47854538febf8d12f7dd16250b2f to your computer and use it in GitHub Desktop.
Save matthewshirley/6fda47854538febf8d12f7dd16250b2f to your computer and use it in GitHub Desktop.
React Native Navigation - Android Installation
..
android {
// Change these two lines
compileSdkVersion 25
buildToolsVersion "25.0.1"
// ...
}
// ...
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"
// Add this line
compile project(':react-native-navigation')
}
package com.yourpackagename; // Make sure to change this to your package
import com.reactnativenavigation.controllers.SplashActivity;
public class MainActivity extends SplashActivity {
}
package com.yourpackagename;
import android.app.Application;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.reactnativenavigation.NavigationApplication;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends NavigationApplication {
@Override
public boolean isDebug() {
// Make sure you are using BuildConfig from your own application
return BuildConfig.DEBUG;
}
protected List<ReactPackage> getPackages() {
// Add additional packages you require here
// No need to add RnnPackage and MainReactPackage
return Arrays.<ReactPackage>asList(
// You can still add third party libs here
);
}
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return getPackages();
}
}
// ...
// Add this at the bottom of the file
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment