diff options
author | Hailey <me@haileyok.com> | 2025-02-27 13:18:30 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-27 13:18:30 -0800 |
commit | a2b71e3a4b786565938cef60924b27c5cd7f0660 (patch) | |
tree | ff78bc233ab5c1507b3f13f2dcbeaac96974ad07 /src/components/Link.tsx | |
parent | a3d36393a16b6219d97d2a553aa426ab108f3168 (diff) | |
download | voidsky-a2b71e3a4b786565938cef60924b27c5cd7f0660.tar.zst |
tweak link handling (#7857)
Diffstat (limited to 'src/components/Link.tsx')
-rw-r--r-- | src/components/Link.tsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/components/Link.tsx b/src/components/Link.tsx index 26cea5968..8bebecbc8 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -69,6 +69,11 @@ type BaseLinkProps = Pick< * Native-only attribute. If true, will open the share sheet on long press. */ shareOnLongPress?: boolean + + /** + * Whether the link should be opened through the redirect proxy. + */ + shouldProxy?: boolean } export function useLink({ @@ -80,9 +85,11 @@ export function useLink({ onLongPress: outerOnLongPress, shareOnLongPress, overridePresentation, + shouldProxy, }: BaseLinkProps & { displayText: string overridePresentation?: boolean + shouldProxy?: boolean }) { const navigation = useNavigationDeduped() const {href} = useLinkProps<AllNavigatorParams>({ @@ -118,7 +125,7 @@ export function useLink({ }) } else { if (isExternal) { - openLink(href, overridePresentation) + openLink(href, overridePresentation, shouldProxy) } else { const shouldOpenInNewTab = shouldClickOpenNewTab(e) @@ -161,6 +168,7 @@ export function useLink({ action, navigation, overridePresentation, + shouldProxy, ], ) @@ -219,6 +227,7 @@ export function Link({ onPress: outerOnPress, onLongPress: outerOnLongPress, download, + shouldProxy, ...rest }: LinkProps) { const {href, isExternal, onPress, onLongPress} = useLink({ @@ -227,6 +236,7 @@ export function Link({ action, onPress: outerOnPress, onLongPress: outerOnLongPress, + shouldProxy: shouldProxy, }) return ( @@ -279,6 +289,7 @@ export function InlineLinkText({ shareOnLongPress, disableUnderline, overridePresentation, + shouldProxy, ...rest }: InlineLinkProps) { const t = useTheme() @@ -292,6 +303,7 @@ export function InlineLinkText({ onLongPress: outerOnLongPress, shareOnLongPress, overridePresentation, + shouldProxy: shouldProxy, }) const { state: hovered, |