@redshank/native-router
Version:
@redshank/native-router is a file-based router for React Native CLI
41 lines • 1.51 kB
TypeScript
import React, { type ReactNode } from 'react';
import type { ParamListBase, RouteProp } from '@react-navigation/native';
export type DynamicConvention = {
name: string;
deep: boolean;
};
export type LoadedRoute = {
default?: React.ComponentType<any>;
screenOptions?: RouteProp<ParamListBase, string> | ((props: {
route: any;
navigation: any;
}) => RouteProp<ParamListBase, string>);
initialParams?: Record<string, any>;
};
export type RouteNode = {
/** Load a route into memory. Returns the exports from a route. */
loadRoute: () => Partial<LoadedRoute>;
/** Loaded initial route name. */
initialRouteName?: string;
/** nested routes */
children: RouteNode[];
/** Is the route a dynamic path */
dynamic: null | DynamicConvention[];
/** `index`, `error-boundary`, etc. */
route: string;
/** Context Module ID, used for matching children. */
contextKey: string;
/** Added in-memory */
generated?: boolean;
/** Internal screens like the directory or the auto 404 should be marked as internal. */
internal?: boolean;
};
/** Return the RouteNode at the current contextual boundary. */
export declare function useRouteNode(): RouteNode | null;
export declare function useContextKey(): string;
/** Provides the matching routes and filename to the children. */
export declare function Route({ children, node, }: {
children: ReactNode;
node: RouteNode;
}): React.JSX.Element;
//# sourceMappingURL=Route.d.ts.map