mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-09 22:51:57 +08:00
- @react-navigation/compat@5.0.0-alpha.9 - @react-navigation/core@5.0.0-alpha.17 - @react-navigation/drawer@5.0.0-alpha.16 - @react-navigation/example@5.0.0-alpha.15 - @react-navigation/material-bottom-tabs@5.0.0-alpha.15 - @react-navigation/native-stack@5.0.0-alpha.4 - @react-navigation/native@5.0.0-alpha.13 - @react-navigation/stack@5.0.0-alpha.28
@react-navigation/core
Core utilities for building navigators.
Installation
Open a Terminal in your project's folder and run,
yarn add @react-navigation/core
Usage
A basic custom navigator bundling a router and a view looks like this:
import { useNavigationBuilder } from '@react-navigation/core';
import { StackRouter } from '@react-navigation/routers';
function StackNavigator({ initialRouteName, children, ...rest }) {
const { state, navigation, descriptors } = useNavigationBuilder(StackRouter, {
initialRouteName,
children,
});
return (
<StackView
state={state}
navigation={navigation}
descriptors={descriptors}
{...rest}
/>
);
}
export default createNavigator(StackNavigator);