[FIX] Can't close the keyboard after entering data in one text box on the screen
This commit is contained in:
parent
c4a2ce20c6
commit
aff4e88b07
|
@ -1,7 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view';
|
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 scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps';
|
||||||
|
import sharedStyles from '../views/Styles';
|
||||||
|
|
||||||
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
|
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
|
||||||
keyboardVerticalOffset?: number;
|
keyboardVerticalOffset?: number;
|
||||||
|
@ -18,7 +20,13 @@ const KeyboardView = ({ style, contentContainerStyle, scrollEnabled, keyboardVer
|
||||||
alwaysBounceVertical={false}
|
alwaysBounceVertical={false}
|
||||||
extraHeight={keyboardVerticalOffset}
|
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
|
||||||
|
* */}
|
||||||
|
<Pressable style={sharedStyles.container} onPress={() => Keyboard.dismiss()}>
|
||||||
|
{children}
|
||||||
|
</Pressable>
|
||||||
</KeyboardAwareScrollView>
|
</KeyboardAwareScrollView>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue