47 lines
2.6 KiB
TypeScript
47 lines
2.6 KiB
TypeScript
import type { BottomTabNavigationEventMap } from '@react-navigation/bottom-tabs';
|
|
import { type EventMapBase, type NavigationProp, type NavigationState, type ParamListBase, type RouteProp, type ScreenListeners } from '@react-navigation/native';
|
|
import type { NativeStackNavigationEventMap } from '@react-navigation/native-stack';
|
|
import React from 'react';
|
|
import { RouteNode } from './Route';
|
|
import { UnknownOutputParams } from './types';
|
|
export type ScreenProps<TOptions extends Record<string, any> = Record<string, any>, TState extends NavigationState = NavigationState, TEventMap extends EventMapBase = EventMapBase> = {
|
|
/** Name is required when used inside a Layout component. */
|
|
name?: string;
|
|
/**
|
|
* Redirect to the nearest sibling route.
|
|
* If all children are `redirect={true}`, the layout will render `null` as there are no children to render.
|
|
*/
|
|
redirect?: boolean;
|
|
initialParams?: Record<string, any>;
|
|
options?: TOptions | ((prop: {
|
|
route: RouteProp<ParamListBase, string>;
|
|
navigation: any;
|
|
}) => TOptions);
|
|
listeners?: ScreenListeners<TState, TEventMap> | ((prop: {
|
|
route: RouteProp<ParamListBase, string>;
|
|
navigation: any;
|
|
}) => ScreenListeners<TState, TEventMap>);
|
|
getId?: ({ params }: {
|
|
params?: Record<string, any>;
|
|
}) => string | undefined;
|
|
dangerouslySingular?: SingularOptions;
|
|
};
|
|
export type SingularOptions = boolean | ((name: string, params: UnknownOutputParams) => string | undefined);
|
|
/**
|
|
* @returns React Navigation screens sorted by the `route` property.
|
|
*/
|
|
export declare function useSortedScreens(order: ScreenProps[], protectedScreens: Set<string>, useOnlyUserDefinedScreens?: boolean): React.ReactNode[];
|
|
/** Wrap the component with various enhancements and add access to child routes. */
|
|
export declare function getQualifiedRouteComponent(value: RouteNode): React.ComponentType<any> | {
|
|
({ route, navigation, ...props }: {
|
|
route?: RouteProp<ParamListBase, string>;
|
|
navigation: Omit<NavigationProp<ParamListBase, string, undefined, NavigationState, object, NativeStackNavigationEventMap | BottomTabNavigationEventMap>, "getState"> & {
|
|
getState(): NavigationState | undefined;
|
|
};
|
|
}): React.JSX.Element;
|
|
displayName: string;
|
|
};
|
|
export declare function screenOptionsFactory(route: RouteNode, options?: ScreenProps['options']): ScreenProps['options'];
|
|
export declare function routeToScreen(route: RouteNode, { options, getId, ...props }?: Partial<ScreenProps>): React.JSX.Element;
|
|
export declare function getSingularId(name: string, options?: Record<string, any>): string;
|
|
//# sourceMappingURL=useScreens.d.ts.map
|