From aff4e88b074bacaa6caa12e10122840af5bdca94 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Tue, 14 Feb 2023 14:35:49 -0300 Subject: [PATCH] [FIX] Can't close the keyboard after entering data in one text box on the screen --- app/containers/KeyboardView.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/containers/KeyboardView.tsx b/app/containers/KeyboardView.tsx index 99df6f923..fec3c2ddf 100644 --- a/app/containers/KeyboardView.tsx +++ b/app/containers/KeyboardView.tsx @@ -1,7 +1,9 @@ import React from 'react'; import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view'; +import { Keyboard, Pressable } from 'react-native'; import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; +import sharedStyles from '../views/Styles'; interface IKeyboardViewProps extends KeyboardAwareScrollViewProps { keyboardVerticalOffset?: number; @@ -18,7 +20,13 @@ const KeyboardView = ({ style, contentContainerStyle, scrollEnabled, keyboardVer alwaysBounceVertical={false} extraHeight={keyboardVerticalOffset} > - {children} + {/** Use Pressable instead of TouchableWithoutFeedback, because the TouchableWithoutFeedback requires a view wrapping the children + * and this wrapping is causing wrong behavior on ScrollView + * https://stackoverflow.com/a/74456534 + * */} + Keyboard.dismiss()}> + {children} + );