From ba1a321e11cf2f5a55c6121c26cb9370f58532ca Mon Sep 17 00:00:00 2001 From: tienifr Date: Sat, 28 Oct 2023 16:22:55 +0700 Subject: [PATCH] fix: 30268 --- src/components/ScreenWrapper/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/ScreenWrapper/index.js b/src/components/ScreenWrapper/index.js index e2af40589a8a..200dd5074c4f 100644 --- a/src/components/ScreenWrapper/index.js +++ b/src/components/ScreenWrapper/index.js @@ -45,6 +45,10 @@ function ScreenWrapper({ const maxHeight = shouldEnableMaxHeight ? windowHeight : undefined; const isKeyboardShown = lodashGet(keyboardState, 'isKeyboardShown', false); + const isKeyboardShownRef = useRef(); + + isKeyboardShownRef.current = lodashGet(keyboardState, 'isKeyboardShown', false); + const panResponder = useRef( PanResponder.create({ onStartShouldSetPanResponderCapture: (e, gestureState) => gestureState.numberActiveTouches === CONST.TEST_TOOL.NUMBER_OF_TAPS, @@ -80,7 +84,7 @@ function ScreenWrapper({ // described here https://reactnavigation.org/docs/preventing-going-back/#limitations const beforeRemoveSubscription = shouldDismissKeyboardBeforeClose ? navigation.addListener('beforeRemove', () => { - if (!isKeyboardShown) { + if (!isKeyboardShownRef.current) { return; } Keyboard.dismiss();