UNPKG

830 BMarkdownView Raw
1# `@react-navigation/core`
2
3Core utilities for building navigators independent of the platform.
4
5## Installation
6
7Open a Terminal in your project's folder and run,
8
9```sh
10yarn add @react-navigation/core
11```
12
13## Usage
14
15A basic custom navigator bundling a router and a view looks like this:
16
17```js
18import { createNavigatorFactory, useNavigationBuilder } from '@react-navigation/core';
19import { StackRouter } from '@react-navigation/routers';
20
21function StackNavigator({ initialRouteName, children, ...rest }) {
22 const { state, navigation, descriptors } = useNavigationBuilder(StackRouter, {
23 initialRouteName,
24 children,
25 });
26
27 return (
28 <StackView
29 state={state}
30 navigation={navigation}
31 descriptors={descriptors}
32 {...rest}
33 />
34 );
35}
36
37export default createNavigatorFactory(StackNavigator);
38```