about summary refs log tree commit diff
path: root/src/view/com/util/Link.tsx
diff options
context:
space:
mode:
authorFoysal Ahamed <foysal@blueskyweb.xyz>2023-09-18 23:34:12 +0200
committerGitHub <noreply@github.com>2023-09-18 14:34:12 -0700
commit3c4899b3c4ae55285559215023a25e365c9f4e30 (patch)
treed8a1433959b4a4ffadc85924c2abb7ff872bc852 /src/view/com/util/Link.tsx
parent255beb0c1f74fe3a72a8069f30395b7774442f88 (diff)
downloadvoidsky-3c4899b3c4ae55285559215023a25e365c9f4e30.tar.zst
:bug: Handle middle mouse click on feed list items (#1469)
* :bug: Handle middle mouse click on feed list items

* :recycle: Refactor the event listener and turn it into a dedicated hook for web

* :broom: Cleanup unnecessary Link changes

* Fix import

* Create native version of useAuxClick

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/util/Link.tsx')
-rw-r--r--src/view/com/util/Link.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/view/com/util/Link.tsx b/src/view/com/util/Link.tsx
index d4df2bec4..1a6f047f6 100644
--- a/src/view/com/util/Link.tsx
+++ b/src/view/com/util/Link.tsx
@@ -59,6 +59,7 @@ export const Link = observer(function Link({
 }: Props) {
   const store = useStores()
   const navigation = useNavigation<NavigationProp>()
+  const anchorHref = asAnchor ? sanitizeUrl(href) : undefined
 
   const onPress = React.useCallback(
     (e?: Event) => {
@@ -96,7 +97,7 @@ export const Link = observer(function Link({
         accessibilityRole="link"
         {...props}>
         {/* @ts-ignore web only -prf */}
-        <View style={style} href={asAnchor ? sanitizeUrl(href) : undefined}>
+        <View style={style} href={anchorHref}>
           {children ? children : <Text>{title || 'link'}</Text>}
         </View>
       </TouchableWithoutFeedback>
@@ -123,7 +124,7 @@ export const Link = observer(function Link({
       accessible={accessible}
       accessibilityRole="link"
       // @ts-ignore web only -prf
-      href={asAnchor ? sanitizeUrl(href) : undefined}
+      href={anchorHref}
       {...props}>
       {children ? children : <Text>{title || 'link'}</Text>}
     </Com>