Skip to content

Commit 257d824

Browse files
arieloOjsamr
authored andcommitted
fix: ARenderer TypeError when href undefined
Fixes TypeError on `href.lenght` when href is undefined - tests `typeof href` is string before reading its length `useNormalizedUrl` can return `undefined` if it fails to parse absolute an url (see: normalizeResourceLocator.ts) > `[TypeError: Cannot read property 'length' of undefined]`
1 parent 5636b6e commit 257d824

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/render/src/renderers/ARenderer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ function useAnchorOnLinkPress(
1616
const { baseTarget } = useDocumentMetadata();
1717
const shouldHandleLinkPress =
1818
tnode.tagName === 'a' &&
19-
typeof normalizedHref === 'string' &&
19+
typeof href === 'string' &&
2020
href.length > 0 &&
21+
typeof normalizedHref === 'string' &&
2122
typeof onPress === 'function';
2223
return shouldHandleLinkPress
2324
? (e: GestureResponderEvent) =>

0 commit comments

Comments
 (0)