From 3925417b3cb124fd23cce2563be2e16ae5661cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Musia=C5=82?= Date: Mon, 8 Sep 2025 15:58:34 +0200 Subject: [PATCH 1/2] fix autofocus issue on closing side panel --- src/hooks/useAutoFocusInput.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hooks/useAutoFocusInput.ts b/src/hooks/useAutoFocusInput.ts index 3f8a41402863..112daa9a51ff 100644 --- a/src/hooks/useAutoFocusInput.ts +++ b/src/hooks/useAutoFocusInput.ts @@ -10,7 +10,6 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import {useSplashScreenStateContext} from '@src/SplashScreenStateContext'; import useOnyx from './useOnyx'; -import usePrevious from './usePrevious'; import useSidePanel from './useSidePanel'; type UseAutoFocusInput = { @@ -63,14 +62,14 @@ export default function useAutoFocusInput(isMultiline = false): UseAutoFocusInpu // Trigger focus when Side Panel transition ends const {isSidePanelTransitionEnded, shouldHideSidePanel} = useSidePanel(); - const prevShouldHideSidePanel = usePrevious(shouldHideSidePanel); useEffect(() => { - if (!shouldHideSidePanel || prevShouldHideSidePanel) { + // Ignore this effect when SidePanel is visible + if (!shouldHideSidePanel) { return; } Promise.all([ComposerFocusManager.isReadyToFocus(), isWindowReadyToFocus()]).then(() => setIsScreenTransitionEnded(isSidePanelTransitionEnded)); - }, [isSidePanelTransitionEnded, shouldHideSidePanel, prevShouldHideSidePanel]); + }, [isSidePanelTransitionEnded, shouldHideSidePanel]); const inputCallbackRef = (ref: TextInput | null) => { inputRef.current = ref; From 73f2a800d48b0a83ac93d8a37deacae7ed9b2e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Musia=C5=82?= Date: Mon, 8 Sep 2025 16:59:44 +0200 Subject: [PATCH 2/2] remove comment --- src/hooks/useAutoFocusInput.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hooks/useAutoFocusInput.ts b/src/hooks/useAutoFocusInput.ts index 112daa9a51ff..35459f195ceb 100644 --- a/src/hooks/useAutoFocusInput.ts +++ b/src/hooks/useAutoFocusInput.ts @@ -63,7 +63,6 @@ export default function useAutoFocusInput(isMultiline = false): UseAutoFocusInpu // Trigger focus when Side Panel transition ends const {isSidePanelTransitionEnded, shouldHideSidePanel} = useSidePanel(); useEffect(() => { - // Ignore this effect when SidePanel is visible if (!shouldHideSidePanel) { return; }