Skip to content

Commit

Permalink
fix: use getRootState instead of getState at navigationRef
Browse files Browse the repository at this point in the history
  • Loading branch information
timepresent95 committed Oct 10, 2024
1 parent 181e7df commit 6199a07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export function navigate(routeName: RouteName) {
throw new Error('Can not find connected navigation container.');
}

const { routes } = navigationRef.getState();
if (routes.find(route => route.name === routeName)) {
const { routeNames } = navigationRef.getRootState();
if (!routeNames.find(name => name === routeName)) {
throw new Error('Tried to navigate to an unavailable route.');
}

Expand Down

0 comments on commit 6199a07

Please sign in to comment.