about summary refs log tree commit diff
path: root/src/components/Link.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-06-11 20:12:05 +0300
committerGitHub <noreply@github.com>2025-06-11 10:12:05 -0700
commit7341294df6156afdf24ab43e1e27ebba94f265ad (patch)
tree2d1e74054f82c3238a4bfcbf55121124dd079e34 /src/components/Link.tsx
parent269105371b22f2de6e8017862a783aaec340948b (diff)
downloadvoidsky-7341294df6156afdf24ab43e1e27ebba94f265ad.tar.zst
Fix using screen names in `Link` (#8473)
* use our router in favour of useLinkBuilder

* test feature using Home header feeds button

* handle non-string params properly
Diffstat (limited to 'src/components/Link.tsx')
-rw-r--r--src/components/Link.tsx8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/components/Link.tsx b/src/components/Link.tsx
index d73a3db4a..49c9c5235 100644
--- a/src/components/Link.tsx
+++ b/src/components/Link.tsx
@@ -4,7 +4,6 @@ import {sanitizeUrl} from '@braintree/sanitize-url'
 import {
   type LinkProps as RNLinkProps,
   StackActions,
-  useLinkBuilder,
 } from '@react-navigation/native'
 
 import {BSKY_DOWNLOAD_URL} from '#/lib/constants'
@@ -95,20 +94,19 @@ export function useLink({
   shouldProxy?: boolean
 }) {
   const navigation = useNavigationDeduped()
-  const {buildHref} = useLinkBuilder()
   const href = useMemo(() => {
     return typeof to === 'string'
       ? convertBskyAppUrlIfNeeded(sanitizeUrl(to))
       : to.screen
-      ? buildHref(to.screen, to.params)
+      ? router.matchName(to.screen)?.build(to.params)
       : to.href
       ? convertBskyAppUrlIfNeeded(sanitizeUrl(to.href))
       : undefined
-  }, [to, buildHref])
+  }, [to])
 
   if (!href) {
     throw new Error(
-      'Link `to` prop must be a string or an object with `screen` and `params` properties',
+      'Could not resolve screen. Link `to` prop must be a string or an object with `screen` and `params` properties',
     )
   }