change the scrollPersistTap

This commit is contained in:
Reinaldo Neto 2023-03-01 18:10:05 -03:00
parent da62dcb214
commit 1f26b82d20
2 changed files with 2 additions and 10 deletions

View File

@ -1,9 +1,7 @@
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;
@ -20,13 +18,7 @@ const KeyboardView = ({ style, contentContainerStyle, scrollEnabled, keyboardVer
alwaysBounceVertical={false} alwaysBounceVertical={false}
extraHeight={keyboardVerticalOffset} extraHeight={keyboardVerticalOffset}
> >
{/** Use Pressable instead of TouchableWithoutFeedback, because the TouchableWithoutFeedback requires a view wrapping the children {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>
); );

View File

@ -1,7 +1,7 @@
import { KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view'; import { KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view';
const scrollPersistTaps: Partial<KeyboardAwareScrollViewProps> = { const scrollPersistTaps: Partial<KeyboardAwareScrollViewProps> = {
keyboardShouldPersistTaps: 'always', keyboardShouldPersistTaps: 'handled',
keyboardDismissMode: 'interactive' keyboardDismissMode: 'interactive'
}; };