import type { createStandardNavigator, NavigatorArgs } from 'standard-navigation'; import type { DefaultNavigatorOptions, DefaultRouterOptions, NavigationAction, NavigationHelpers, NavigationState, ParamListBase } from '../react-navigation/native'; import type { GoBackAction, NavigateAction } from '../react-navigation/routers/CommonActions'; import type { ErrorBoundaryProps } from '../views/Try'; export type StandardNavigatorEventMapBase = Record; export type StandardNavigationAction = NavigateAction | GoBackAction; export type StandardNavigator = ReturnType>; export type StandardUseNavigationBuilderOptions = DefaultNavigatorOptions; export interface StandardNavigatorCreatePropsFactoryDeps { state: State; dispatch: (action: NavigationAction) => void; navigation: NavigationHelpers; } /** * Allows router-specific information to be exposed via navigator props alongside the standard * `state` and `actions`. * * Receives the raw Expo Router `state` and `dispatch`. Both are internal and may have small * breaking changes between releases, so prefer the `state` and `actions` passed to * `NavigatorContent` when they suffice. * * @example * ```tsx * createProps: ({ state, dispatch }) => ({ * activeRouteKey: state.routes[state.index].key, * preload: (name: string) => dispatch({ type: 'PRELOAD', payload: { name } }), * }) * ``` */ type CreatePropsFn = (deps: StandardNavigatorCreatePropsFactoryDeps) => CreateProps; type CreatePropsOption = [ keyof CreateProps ] extends [never] ? { /** * Declare injected props with the fourth type argument of `NavigatorContentProps` before * providing this factory. */ createProps?: never; } : { createProps: CreatePropsFn; }; export type IntegrateWithRouterOptions = { /** * When `true`, only screens explicitly declared as `` children are rendered; * routes discovered from the filesystem that were not declared are ignored. */ useOnlyUserDefinedScreens?: boolean; } & CreatePropsOption; export type StandardNavigatorContentProps = NavigatorArgs & Omit>; /** * Lets TypeScript infer `EventMap`, `NavigatorProps`, and `CreateProps` from a `NavigatorContent` * component. * * On their own these can't be inferred: `EventMap` only appears as an argument to `emitter.emit`, * while `NavigatorProps` and `CreateProps` are combined inside an intersection and `Omit` — none * are positions TypeScript can read a type back out of. Without these properties it gives up and * falls back to the base shapes, rejecting components that declare specific events or extra props. * * The properties are phantom: they never exist at runtime and are never read. They exist only to * put each type somewhere TypeScript will infer it from. */ type NavigatorContentInferenceCarrier = { /** @internal */ readonly __eventMap__?: EventMap; /** @internal */ readonly __navigatorProps__?: NavigatorProps; /** @internal */ readonly __createProps__?: CreateProps; }; /** * Props for a standard navigator's `NavigatorContent` component. Annotate your content component * with this type to declare the events it emits, so `unstable_createStandardRouterNavigator` can * type `emitter.emit` for you. * * @example * ```tsx * // No events: * type TabsContentProps = NavigatorContentProps<{ title?: string }>; * * // Typed events: * type TabsContentProps = NavigatorContentProps< * { title?: string }, * { tabPress: { data: undefined; canPreventDefault: true } }, * { tintColor?: string }, * { activeRouteKey: string } * >; * ``` */ export type NavigatorContentProps, NavigatorProps extends object = object, CreateProps extends object = object> = StandardNavigatorContentProps & NavigatorContentInferenceCarrier; export type StandardRouterNavigatorProps = StandardUseNavigationBuilderOptions & NavigatorProps & RouterOptions & { /** A component to render when an individual screen in this navigator throws an error. */ unstable_screenErrorBoundary?: React.ComponentType; }; export {}; //# sourceMappingURL=types.d.ts.map