A utility library for facilitating React Native development with Android Fragments.
React Native Android Fragment isn't available via npm. This is intended to be used solely in an Android Project and therefore we are shipping this over jcenter (maven/gradle). You can download via Gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
// Version will correspond to its dependnecy on React Native
compile 'com.github.hudl:react-native-android-fragment:v0.43.2'
}
Or Maven:
<dependency>
<groupId>com.hudl.oss</groupId>
<artifactId>react-native-android-fragment</artifactId>
<version>0.43.2</version>
</dependency>
The primary component in this library is ReactFragment You can use this class directly if you wish, or you can extend from it to simplify your code.
A Builder pattern is provided out of the box for easy usage:
Fragment messagingFragment = new ReactFragment.Builder()
.setComponentName("HelloWorld")
.setLaunchOptions(launchOptions) // A Bundle of launch options
.build();
NOTE: Make sure your environment is set up for React Native and Android development.
- Clone the repo
- Open a terminal and navigate to the root directory of your checkout
cd sample-app
yarn
- Open the project in Android Studio and let everything build
- Back in your terminal run
react-native start
- In Android Studio run the
app
on an emulator or your device