Skip to content

Commit 748f1e5

Browse files
grgiaOSBotify
authored andcommitted
Merge pull request #59378 from nkdengineer/fix/59352
fix: start chat page is broken after refreshing the page (cherry picked from commit e79a743) (CP triggered by mountiny)
1 parent 6a558fa commit 748f1e5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/hooks/useAutoFocusInput.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {InteractionManager} from 'react-native';
66
import {moveSelectionToEnd, scrollToBottom} from '@libs/InputUtils';
77
import CONST from '@src/CONST';
88
import {useSplashScreenStateContext} from '@src/SplashScreenStateContext';
9+
import usePrevious from './usePrevious';
910
import useSidePane from './useSidePane';
1011

1112
type UseAutoFocusInput = {
@@ -56,13 +57,14 @@ export default function useAutoFocusInput(isMultiline = false): UseAutoFocusInpu
5657

5758
// Trigger focus when side pane transition ends
5859
const {isSidePaneTransitionEnded, shouldHideSidePane} = useSidePane();
60+
const prevShouldHideSidePane = usePrevious(shouldHideSidePane);
5961
useEffect(() => {
60-
if (!shouldHideSidePane) {
62+
if (!shouldHideSidePane || prevShouldHideSidePane) {
6163
return;
6264
}
6365

6466
setIsScreenTransitionEnded(isSidePaneTransitionEnded);
65-
}, [isSidePaneTransitionEnded, shouldHideSidePane]);
67+
}, [isSidePaneTransitionEnded, shouldHideSidePane, prevShouldHideSidePane]);
6668

6769
const inputCallbackRef = (ref: TextInput | null) => {
6870
inputRef.current = ref;

src/hooks/useSidePane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function useSidePane() {
5656
const {windowWidth} = useWindowDimensions();
5757
const sidePaneWidth = shouldUseNarrowLayout ? windowWidth : variables.sideBarWidth;
5858

59-
const [isSidePaneTransitionEnded, setIsSidePaneTransitionEnded] = useState(true);
59+
const [isSidePaneTransitionEnded, setIsSidePaneTransitionEnded] = useState(false);
6060
const {shouldHideSidePane, shouldHideSidePaneBackdrop, shouldHideHelpButton, sidePaneNVP} = useSidePaneDisplayStatus();
6161
const shouldHideToolTip = isExtraLargeScreenWidth ? !isSidePaneTransitionEnded : !shouldHideSidePane;
6262

0 commit comments

Comments
 (0)