Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions website/versioned_docs/version-0.5/navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,65 @@ The community solution to navigation is a standalone library that allows develop
The first step is to install in your project:

```
npm install --save react-navigation
yarn add react-navigation
# or with npm
# npm install react-navigation
```

The second step is to install react-native-gesture-handler
The second step is to install additional dependencies such as `react-native-gesture-handler`, `react-native-reanimated`, `react-native-screens`, `react-native-safe-area-context`, and `@react-native-community/masked-view`:

```
yarn add react-native-gesture-handler
# or with npm
# npm install --save react-native-gesture-handler
npm install --save react-navigation react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
```

To complete your installation on **iOS**, make sure you have [Cocoapods](https://cocoapods.org/). Then run:

```
cd ios
pod install
cd ..
```

To Complete your installation on **Android**. Add the following two lines to dependencies section in `android/app/build.gradle`:

```
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
```

And make the following modifications to `MainActivity.java`:

```diff
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);
+ }
+ };
+ }
}
```

Then add the following at the top of your entry file, such as `index.js` or `App.js`:

```
import 'react-native-gesture-handler'
```

The third step is to install react-navigation-stack
Expand Down