import { Sheets, ActionSheetRef } from '../types'; import { SharedValue } from 'react-native-reanimated'; export type RouteDefinition = T; export type Route = { /** * Name of the route. */ name: K | (string & {}); /** * A react component that will render when this route is navigated to. */ component: any; /** * Initial params for the route. */ params?: Sheets[Key]['routes'][K]; }; export type Router = { currentRoute: Route; /** * Navigate to a route * * @param name Name of the route to navigate to * @param params Params to pass to the route upon navigation. These can be accessed in the route using `useSheetRouteParams` hook. * @param snap Snap value for navigation animation. Between -100 to 100. A positive value snaps inwards, while a negative value snaps outwards. */ navigate: (name: RouteKey | (string & {}), params?: Sheets[Key]['routes'][RouteKey] | any, snap?: number) => void; /** * Navigate back from a route. * * @param name Name of the route to navigate back to. * @param snap Snap value for navigation animation. Between -100 to 100. A positive value snaps inwards, while a negative value snaps outwards. */ goBack: (name?: RouteKey | (string & {}), snap?: number) => void; /** * Close the action sheet. */ close: () => void; /** * Pop to top of the stack. */ popToTop: () => void; /** * Whether this router has any routes registered. */ hasRoutes: () => boolean | undefined; /** * Get the currently rendered stack. */ stack: Route[]; /** * An internal function called by sheet to navigate to initial route. */ initialNavigation: () => void; canGoBack: () => boolean; }; export declare const useRouter: ({ onNavigate, onNavigateBack, initialRoute, routes, getRef, routeOpacity, }: { initialRoute?: string; routes?: Route[]; getRef?: () => ActionSheetRef; onNavigate?: (route: string) => void; onNavigateBack?: (route: string) => void; routeOpacity: SharedValue; }) => Router; export declare const RouterContext: import("react").Context>; /** * A hook that you can use to control the router. */ export declare function useSheetRouter(id?: SheetId | (string & {})): Router | undefined; export declare const RouterParamsContext: import("react").Context; /** * A hook that returns the params for current navigation route. */ export declare function useSheetRouteParams(_id?: SheetId | (string & {}), _routeKey?: RouteKey | (string & {})): Sheets[SheetId]['routes'][RouteKey]; export type RouteScreenProps = { router: Router; params: Sheets[SheetId]['routes'][RouteKey]; /** * @deprecated use `useSheetPayload` hook. */ payload: Sheets[SheetId]['beforeShowPayload']; }; //# sourceMappingURL=use-router.d.ts.map