UNPKG

1.5 kBTypeScriptView Raw
1import { type NavigationAction } from '@react-navigation/core';
2import * as React from 'react';
3import { type GestureResponderEvent } from 'react-native';
4export type LinkProps<ParamList extends ReactNavigation.RootParamList, RouteName extends keyof ParamList = keyof ParamList> = ({
5 href?: string;
6 action?: NavigationAction;
7} & {
8 [Screen in keyof ParamList]: undefined extends ParamList[Screen] ? {
9 screen: Screen;
10 params?: ParamList[Screen];
11 } : {
12 screen: Screen;
13 params: ParamList[Screen];
14 };
15}[RouteName]) | {
16 href?: string;
17 action: NavigationAction;
18 screen?: undefined;
19 params?: undefined;
20};
21/**
22 * Hook to get props for an anchor tag so it can work with in page navigation.
23 *
24 * @param props.screen Name of the screen to navigate to (e.g. `'Feeds'`).
25 * @param props.params Params to pass to the screen to navigate to (e.g. `{ sort: 'hot' }`).
26 * @param props.href Optional absolute path to use for the href (e.g. `/feeds/hot`).
27 * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
28 */
29export declare function useLinkProps<ParamList extends ReactNavigation.RootParamList>({ screen, params, href, action, }: LinkProps<ParamList>): {
30 href: string | undefined;
31 accessibilityRole: "link";
32 onPress: (e?: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
33};
34//# sourceMappingURL=useLinkProps.d.ts.map
\No newline at end of file