From 967eb0f67af9e81c80a074da2acf510e7cba0536 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 28 Oct 2024 13:58:21 +0700 Subject: [PATCH] fix: prevent open search when onboarding is not completed --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 68cc7e748413a..f9c3fbc442b07 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -260,6 +260,12 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie isInitialRender.current = false; } + const isOnboardingCompletedRef = useRef(isOnboardingCompleted); + + useEffect(() => { + isOnboardingCompletedRef.current = isOnboardingCompleted; + }, [isOnboardingCompleted]); + useEffect(() => { const shortcutsOverviewShortcutConfig = CONST.KEYBOARD_SHORTCUTS.SHORTCUTS; const searchShortcutConfig = CONST.KEYBOARD_SHORTCUTS.SEARCH; @@ -358,6 +364,9 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie searchShortcutConfig.shortcutKey, () => { Session.checkIfActionIsAllowed(() => { + if (!isOnboardingCompletedRef.current) { + return; + } toggleSearchRouter(); })(); },