Skip to content

Commit 232474d

Browse files
committed
fix link crash
1 parent 2e2c76b commit 232474d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/Link.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ export function useLink({
165165
if (isNative && screen !== 'NotFound') {
166166
const state = navigation.getState()
167167
// if screen is not in the current navigator, it means it's
168-
// most likely a tab screen
169-
if (state && !state.routeNames.includes(screen)) {
168+
// most likely a tab screen. note: state can be undefined
169+
if (!state?.routeNames.includes(screen)) {
170170
const parent = navigation.getParent()
171171
if (
172172
parent &&

0 commit comments

Comments
 (0)