diff --git a/src/components/Link.tsx b/src/components/Link.tsx
index fa8fa0cc3a..010299dfba 100644
--- a/src/components/Link.tsx
+++ b/src/components/Link.tsx
@@ -329,6 +329,25 @@ export function InlineLinkText({
)
}
+/**
+ * Utility to create a static `onPress` handler for a `Link` that would otherwise link to a URI
+ *
+ * Example:
+ * ` {...})} />`
+ */
+export function createStaticClick(
+ onPressHandler: Exclude,
+): Pick {
+ return {
+ to: '#',
+ onPress(e: GestureResponderEvent) {
+ e.preventDefault()
+ onPressHandler(e)
+ return false
+ },
+ }
+}
+
/**
* A Pressable that uses useLink to handle navigation. It is unstyled, so can be used in cases where the Button styles
* in Link are not desired.
diff --git a/src/components/TagMenu/index.tsx b/src/components/TagMenu/index.tsx
index 917624a036..ae9fcdae21 100644
--- a/src/components/TagMenu/index.tsx
+++ b/src/components/TagMenu/index.tsx
@@ -4,7 +4,6 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useNavigation} from '@react-navigation/native'
-import {makeSearchLink} from '#/lib/routes/links'
import {NavigationProp} from '#/lib/routes/types'
import {isInvalidHandle} from '#/lib/strings/handles'
import {
@@ -19,7 +18,7 @@ import {Divider} from '#/components/Divider'
import {MagnifyingGlass2_Stroke2_Corner0_Rounded as Search} from '#/components/icons/MagnifyingGlass2'
import {Mute_Stroke2_Corner0_Rounded as Mute} from '#/components/icons/Mute'
import {Person_Stroke2_Corner0_Rounded as Person} from '#/components/icons/Person'
-import {Link} from '#/components/Link'
+import {createStaticClick, Link} from '#/components/Link'
import {Loader} from '#/components/Loader'
import {Text} from '#/components/Typography'
@@ -101,19 +100,14 @@ export function TagMenu({
t.atoms.bg_contrast_25,
]}>
{
- e.preventDefault()
-
+ label={_(msg`View all posts with tag ${displayTag}`)}
+ {...createStaticClick(() => {
control.close(() => {
navigation.push('Hashtag', {
tag: encodeURIComponent(tag),
})
})
-
- return false
- }}>
+ })}>
{
- e.preventDefault()
-
+ {...createStaticClick(() => {
control.close(() => {
navigation.push('Hashtag', {
tag: encodeURIComponent(tag),
author: authorHandle,
})
})
-
- return false
- }}>
+ })}>