withLayoutContext

Create your own layouts.

Today there are a few built-in navigators: Slot, Stack, etc. But you may want to create your own.

A React Navigation navigator can become a One layout through withLayoutContext. For example, an app can wrap a native stack with shared route sorting and protected-route support:

To make any React Navigation navigator work inside a One layout, use withLayoutContext:

import { createNativeStackNavigator } from '@react-navigation/native-stack'
import { withLayoutContext } from 'one'
const ModalNavigator = createNativeStackNavigator().Navigator
export const ModalStack = withLayoutContext(
ModalNavigator
)

Now you can use ModalStack in any _layout.tsx file.

Edit this page on GitHub.