React Native Navigation by Wix is the best library I have found as a navigation solution. The biggest limitation is when you want to render a global element outside of the navigation stack. This allows you to render that element and still have it communicate with the rest of your app.
$ npm install react-native-navigation-extra-view --save
$ react-native link react-native-navigation-extra-view
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-navigation-extra-view
and addRNNExtraView.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNNExtraView.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNNExtraViewPackage;
to the imports at the top of the file - Add
new RNNExtraViewPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-navigation-extra-view' project(':react-native-navigation-extra-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation-extra-view/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-navigation-extra-view')
import RNNExtraView from 'react-native-navigation-extra-view';
-
Register your view
ExtraView.registerComponent('Test', () => TestComponent, stores, Provider)
orExtraView.registerComponent('Test', () => TestComponent)
-
Start RNN app normally. In the
then
, init the view
Navigation.startSingleScreenApp({
screen: {
screen: 'MyApp.Home',
title: 'Home',
navigatorStyle: {...}
}
}).then(()=>{
RNNExtraView.init('Test')
});