Skip to content

Commit

Permalink
Merge pull request #30557 from tienifr/fix/30268
Browse files Browse the repository at this point in the history
fix: 30268 The keyboard closes after a moment when tapping back button
  • Loading branch information
arosiclair authored Nov 6, 2023
2 parents 12ff3ea + ed42039 commit fa89ada
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/ScreenWrapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ function ScreenWrapper({
const minHeight = shouldEnableMinHeight ? initialHeight : 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,
Expand Down Expand Up @@ -84,7 +88,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();
Expand Down

0 comments on commit fa89ada

Please sign in to comment.