1 | {"version":3,"names":["Link","to","action","rest","props","useLinkProps","onPress","e","React","createElement","Text","Platform","select","web","onClick","default"],"sources":["Link.tsx"],"sourcesContent":["import type { NavigationAction } from '@react-navigation/core';\nimport * as React from 'react';\nimport { GestureResponderEvent, Platform, Text, TextProps } from 'react-native';\n\nimport useLinkProps from './useLinkProps';\nimport type { To } from './useLinkTo';\n\ntype Props<ParamList extends ReactNavigation.RootParamList> = {\n to: To<ParamList>;\n action?: NavigationAction;\n target?: string;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n} & (TextProps & { children: React.ReactNode });\n\n/**\n * Component to render link to another screen using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.to Absolute path to screen (e.g. `/feeds/hot`).\n * @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.\n * @param props.children Child elements to render the content.\n */\nexport default function Link<ParamList extends ReactNavigation.RootParamList>({\n to,\n action,\n ...rest\n}: Props<ParamList>) {\n const props = useLinkProps<ParamList>({ to, action });\n\n const onPress = (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => {\n if ('onPress' in rest) {\n rest.onPress?.(e);\n }\n\n props.onPress(e);\n };\n\n return React.createElement(Text, {\n ...props,\n ...rest,\n ...Platform.select({\n web: { onClick: onPress } as any,\n default: { onPress },\n }),\n });\n}\n"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,IAAT,OAIM;EAAA,IAJyD;IAC5EC,EAD4E;IAE5EC,MAF4E;IAG5E,GAAGC;EAHyE,CAIzD;EACnB,MAAMC,KAAK,GAAG,IAAAC,qBAAA,EAAwB;IAAEJ,EAAF;IAAMC;EAAN,CAAxB,CAAd;;EAEA,MAAMI,OAAO,GACXC,CADc,IAEX;IACH,IAAI,aAAaJ,IAAjB,EAAuB;MAAA;;MACrB,iBAAAA,IAAI,CAACG,OAAL,qEAAAH,IAAI,EAAWI,CAAX,CAAJ;IACD;;IAEDH,KAAK,CAACE,OAAN,CAAcC,CAAd;EACD,CARD;;EAUA,oBAAOC,KAAK,CAACC,aAAN,CAAoBC,iBAApB,EAA0B,EAC/B,GAAGN,KAD4B;IAE/B,GAAGD,IAF4B;IAG/B,GAAGQ,qBAAA,CAASC,MAAT,CAAgB;MACjBC,GAAG,EAAE;QAAEC,OAAO,EAAER;MAAX,CADY;MAEjBS,OAAO,EAAE;QAAET;MAAF;IAFQ,CAAhB;EAH4B,CAA1B,CAAP;AAQD"} |