-
Install React Navigation package:
$ npm i react-navigation
-
Install React Native Gesture Handler:
$ npm i react-native-gesture-handler
-
Link all dependencies:
$ react-native link react-native-gesture-handler
-
Go to MainActivity.java then add lines below with plus ('+') sign:
path: [yourProject]/android/app/src/main/java/com/[yourProject]/MainActivity.java
package com.reactnavigation.example; import com.facebook.react.ReactActivity; + import com.facebook.react.ReactActivityDelegate; + import com.facebook.react.ReactRootView; + import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; public class MainActivity extends ReactActivity { @Override protected String getMainComponentName() { return "Example"; } + @Override + protected ReactActivityDelegate createReactActivityDelegate() { + return new ReactActivityDelegate(this, getMainComponentName()) { + @Override + protected ReactRootView createRootView() { + return new RNGestureHandlerEnabledRootView(MainActivity.this); + } + }; + } }
-
Go to [yourProject]/android/settings.gradle then change all backslash '\' with slash '/' sp it will look like:
rootProject.name = 'navigasi' include ':react-native-gesture-handler' project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android') include ':app'
Lintang Wisesa 💌 lintangwisesa@ymail.com
Facebook | Twitter | Google+ | Youtube | :octocat: GitHub | Hackster