UNPKG

4.6 kBTypeScriptView Raw
1import * as React from "react";
2import type { GestureResponderEvent, TouchableHighlightProps } from "react-native";
3import type { To, MemoryRouterProps, NavigateOptions, RelativeRoutingType } from "react-router";
4import URLSearchParams from "@ungap/url-search-params";
5export type { ActionFunction, ActionFunctionArgs, AwaitProps, Blocker, BlockerFunction, DataRouteMatch, DataRouteObject, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathParam, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult, } from "react-router";
6export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router";
7/** @internal */
8export { UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, } from "react-router";
9export interface NativeRouterProps extends MemoryRouterProps {
10}
11/**
12 * A `<Router>` that runs on React Native.
13 */
14export declare function NativeRouter(props: NativeRouterProps): React.JSX.Element;
15export interface LinkProps extends TouchableHighlightProps {
16 children?: React.ReactNode;
17 onPress?: (event: GestureResponderEvent) => void;
18 relative?: RelativeRoutingType;
19 replace?: boolean;
20 state?: any;
21 to: To;
22}
23/**
24 * A `<TouchableHighlight>` that navigates to a different URL when touched.
25 */
26export declare function Link({ onPress, relative, replace, state, to, ...rest }: LinkProps): React.JSX.Element;
27/**
28 * Handles the press behavior for router `<Link>` components. This is useful if
29 * you need to create custom `<Link>` components with the same press behavior we
30 * use in our exported `<Link>`.
31 */
32export declare function useLinkPressHandler(to: To, { replace, state, relative, }?: {
33 replace?: boolean;
34 state?: any;
35 relative?: RelativeRoutingType;
36}): (event: GestureResponderEvent) => void;
37/**
38 * Enables support for the hardware back button on Android.
39 */
40export declare function useHardwareBackButton(): void;
41export { useHardwareBackButton as useAndroidBackButton };
42/**
43 * Enables deep linking, both on the initial app launch and for
44 * subsequent incoming links.
45 */
46export declare function useDeepLinking(): void;
47/**
48 * A convenient wrapper for accessing individual query parameters via the
49 * URLSearchParams interface.
50 */
51export declare function useSearchParams(defaultInit?: URLSearchParamsInit): [URLSearchParams, SetURLSearchParams];
52export type SetURLSearchParams = (nextInit?: URLSearchParamsInit | ((prev: URLSearchParams) => URLSearchParamsInit), navigateOpts?: NavigateOptions) => void;
53export type ParamKeyValuePair = [string, string];
54export type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
55/**
56 * Creates a URLSearchParams object using the given initializer.
57 *
58 * This is identical to `new URLSearchParams(init)` except it also
59 * supports arrays as values in the object form of the initializer
60 * instead of just strings. This is convenient when you need multiple
61 * values for a given key, but don't want to use an array initializer.
62 *
63 * For example, instead of:
64 *
65 * let searchParams = new URLSearchParams([
66 * ['sort', 'name'],
67 * ['sort', 'price']
68 * ]);
69 *
70 * you can do:
71 *
72 * let searchParams = createSearchParams({
73 * sort: ['name', 'price']
74 * });
75 */
76export declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams;