Skip to content

Commit

Permalink
fix: use getState to get current screen name
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Sep 3, 2023
1 parent d152108 commit ed77d60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pages/MainMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const MainMenu: FC<StackScreenProps<RootStackParameterList, 'MainMenu'>>
useEffect(() => {
if (!autoOpenDefaultWiki) return;
const defaultWiki = wikis[0];
if (defaultWiki !== undefined && fromWikiID === undefined && route.name === 'MainMenu') {
const currentScreen = navigation.getState()?.routes.at(-1)?.name;
if (defaultWiki !== undefined && fromWikiID === undefined && currentScreen === 'MainMenu') {
navigation.navigate('WikiWebView', { id: defaultWiki.id });
}
}, [navigation, wikis, fromWikiID, route.name, autoOpenDefaultWiki]);
Expand Down

0 comments on commit ed77d60

Please sign in to comment.