mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-28 06:56:08 +08:00
29 lines
605 B
Markdown
29 lines
605 B
Markdown
# `@react-navigation/compat`
|
|
|
|
Compatibility layer to write navigator definitions in static configuration format.
|
|
|
|
## Installation
|
|
|
|
Open a Terminal in your project's folder and run,
|
|
|
|
```sh
|
|
yarn add @react-navigation/core @react-navigation/compat
|
|
```
|
|
|
|
## Usage
|
|
|
|
```js
|
|
import { createCompatNavigatorFactory } from '@react-navigation/compat';
|
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
|
|
const RootStack = createCompatNavigatorFactory(createStackNavigator)(
|
|
{
|
|
Home: { screen: HomeScreen },
|
|
Profile: { screen: ProfileScreen },
|
|
},
|
|
{
|
|
initialRouteName: 'Profile',
|
|
}
|
|
);
|
|
```
|