import { createNavigatorFactory, type NavigatorTypeBagBase, type ParamListBase, type StaticConfig, type TypedNavigator, useNavigationBuilder, } from '@react-navigation/core'; import { TrueSheetRouter, type TrueSheetRouterOptions } from './TrueSheetRouter'; import { TrueSheetView } from './TrueSheetView'; import type { TrueSheetActionHelpers, TrueSheetNavigationEventMap, TrueSheetNavigationOptions, TrueSheetNavigationProp, TrueSheetNavigationState, TrueSheetNavigatorProps, } from './types'; const TrueSheetNavigator = ({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, }: TrueSheetNavigatorProps) => { const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder< TrueSheetNavigationState, TrueSheetRouterOptions, TrueSheetActionHelpers, TrueSheetNavigationOptions, TrueSheetNavigationEventMap >(TrueSheetRouter, { id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, }); return ( ); }; /** * Creates a TrueSheet navigator. * * @example * ```tsx * const Sheet = createTrueSheetNavigator(); * * function App() { * return ( * * * * * ); * } * ``` */ export const createTrueSheetNavigator = < const ParamList extends ParamListBase, const NavigatorID extends string | undefined = undefined, const TypeBag extends NavigatorTypeBagBase = { ParamList: ParamList; NavigatorID: NavigatorID; State: TrueSheetNavigationState; ScreenOptions: TrueSheetNavigationOptions; EventMap: TrueSheetNavigationEventMap; NavigationList: { [RouteName in keyof ParamList]: TrueSheetNavigationProp; }; Navigator: typeof TrueSheetNavigator; }, const Config extends StaticConfig = StaticConfig, >( config?: Config ): TypedNavigator => { return createNavigatorFactory(TrueSheetNavigator)(config); };