From ed77d6012aa97bc21d8e12e191b6200a448f943e Mon Sep 17 00:00:00 2001 From: linonetwo Date: Sun, 3 Sep 2023 12:33:41 +0800 Subject: [PATCH] fix: use getState to get current screen name --- src/pages/MainMenu/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/MainMenu/index.tsx b/src/pages/MainMenu/index.tsx index 08fd855..49c8a62 100644 --- a/src/pages/MainMenu/index.tsx +++ b/src/pages/MainMenu/index.tsx @@ -32,7 +32,8 @@ export const MainMenu: FC> 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]);