UNPKG

899 BTypeScriptView Raw
1import { NavigationAction } from '@react-navigation/core';
2import * as React from 'react';
3import { GestureResponderEvent } from 'react-native';
4import { To } from './useLinkTo';
5declare type Props<ParamList extends ReactNavigation.RootParamList> = {
6 to: To<ParamList>;
7 action?: NavigationAction;
8};
9/**
10 * Hook to get props for an anchor tag so it can work with in page navigation.
11 *
12 * @param props.to Absolute path to screen (e.g. `/feeds/hot`).
13 * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
14 */
15export default function useLinkProps<ParamList extends ReactNavigation.RootParamList>({ to, action }: Props<ParamList>): {
16 href: string;
17 accessibilityRole: "link";
18 onPress: (e?: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent | undefined) => void;
19};
20export {};