Skip to content

Commit 0c8e28e

Browse files
Dave Olsenvonovak
authored andcommitted
add complete installation instructions for Android (react-navigation#304)
* add complete installation instructions for Android * lint copy pasted code
1 parent a2f7f67 commit 0c8e28e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/getting-started.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,37 @@ Link all native dependencies:
3838
react-native link
3939
```
4040

41+
No additional steps are required for iOS.
42+
43+
To finalise installation of react-native-gesture-handler for Android, be sure to make the necessary modifications to `MainActivity.java`:
44+
45+
```diff
46+
package com.reactnavigation.example;
47+
48+
import com.facebook.react.ReactActivity;
49+
+ import com.facebook.react.ReactActivityDelegate;
50+
+ import com.facebook.react.ReactRootView;
51+
+ import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
52+
53+
public class MainActivity extends ReactActivity {
54+
55+
@Override
56+
protected String getMainComponentName() {
57+
return "Example";
58+
}
59+
60+
+ @Override
61+
+ protected ReactActivityDelegate createReactActivityDelegate() {
62+
+ return new ReactActivityDelegate(this, getMainComponentName()) {
63+
+ @Override
64+
+ protected ReactRootView createRootView() {
65+
+ return new RNGestureHandlerEnabledRootView(MainActivity.this);
66+
+ }
67+
+ };
68+
+ }
69+
}
70+
```
71+
4172
## Hybrid iOS Applications (Skip for RN only projects)
4273

4374
If you're using React Navigation within a hybrid app - an iOS app that has both Swift/ObjC and React Native parts - you may be missing the `RCTLinkingIOS` subspec in your Podfile, which is installed by default in new RN projects. To add this, ensure your Podfile looks like the following:

0 commit comments

Comments
 (0)