Skip to content

Commit 2afc2a9

Browse files
authored
Add NavigationContainer to upgrading-from-4.x guide (#661)
1 parent 3ba5180 commit 2afc2a9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

website/versioned_docs/version-5.x/upgrading-from-4.x.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ For React Navigation 5, we went with scoped packages (e.g. `@react-navigation/st
2323
- `react-navigation-material-bottom-tabs` -> `@react-navigation/material-bottom-tabs`
2424
- `react-navigation-drawer` -> `@react-navigation/drawer`
2525

26+
## Navigation Container
27+
28+
In React Navigation 5.x there's no `createAppContainer` which provided screens with navigation context. You'll need to wrap your app with [NavigationContainer](app-containers.html) provider.
29+
30+
```js
31+
import { NavigationContainer } from '@react-navigation/native';
32+
33+
export default function App() {
34+
return <NavigationContainer>{/*...*/}</NavigationContainer>
35+
}
36+
```
37+
38+
The `onNavigationStateChange` prop on the AppContainer is now available as `onStateChange` on NavigationContainer.
39+
2640
## Configuring the navigator
2741

2842
In React Navigation 4.x, we used to statically configure our navigator to `createXNavigator` functions. The first parameter was an object containing route configuration, and the second parameter was configuration for the navigator.

0 commit comments

Comments
 (0)