mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-09 17:23:18 +08:00
- @react-navigation/bottom-tabs@5.0.0-alpha.11 - @react-navigation/compat@5.0.0-alpha.5 - @react-navigation/core@5.0.0-alpha.12 - @react-navigation/drawer@5.0.0-alpha.11 - @react-navigation/example@5.0.0-alpha.9 - @react-navigation/material-bottom-tabs@5.0.0-alpha.10 - @react-navigation/material-top-tabs@5.0.0-alpha.9 - @react-navigation/native@5.0.0-alpha.9 - @react-navigation/routers@5.0.0-alpha.9 - @react-navigation/stack@5.0.0-alpha.21
@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);