@redshank/native-router
Version:
@redshank/native-router is a file-based router for React Native CLI
40 lines • 1.95 kB
TypeScript
import type { EventMapBase, NavigationState, ParamListBase, RouteProp, ScreenListeners } from '@react-navigation/native';
import React, { type ComponentType } from 'react';
import { Protected } from './Protected';
import type { PickPartial } from '../../types/function-type';
export type ScreenProps<TOptions extends Record<string, any> = Record<string, any>, State extends NavigationState = NavigationState, EventMap extends EventMapBase = EventMapBase> = {
/** Name of screen */
name?: string;
/**
* Navigator options for this screen.
*/
options?: TOptions | ((props: {
route: RouteProp<ParamListBase, string>;
navigation: any;
}) => TOptions);
/**
* Event listeners for this screen.
*/
listeners?: ScreenListeners<State, EventMap> | ((props: {
route: RouteProp<ParamListBase, string>;
navigation: any;
}) => ScreenListeners<State, EventMap>);
/**
* Function to return an unique ID for this screen.
* Receives an object with the route params.
* For a given screen name, there will always be only one screen corresponding to an ID.
* If `undefined` is returned, it acts same as no `getId` being specified.
*/
getId?: ({ params, }: {
params: Record<string, any> | undefined;
}) => string | undefined;
/**
* Initial params object for the route.
*/
initialParams?: Record<string, any>;
};
export declare const createNavigator: <TOptions extends object, T extends ComponentType<any>, TState extends NavigationState, TEventMap extends EventMapBase>(Nav: T, processor?: (options: ScreenProps[]) => ScreenProps[]) => React.ForwardRefExoticComponent<React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, "children">> & React.RefAttributes<unknown>> & {
Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;
Protected: typeof Protected;
};
//# sourceMappingURL=createNavigator.d.ts.map