2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
2021-11-10 15:10:34 +00:00
|
|
|
import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
|
|
|
|
2021-11-10 15:10:34 +00:00
|
|
|
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
|
2021-09-13 20:41:05 +00:00
|
|
|
keyboardVerticalOffset: number;
|
2021-11-10 15:10:34 +00:00
|
|
|
children: React.ReactNode;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default class KeyboardView extends React.PureComponent<IKeyboardViewProps, any> {
|
|
|
|
render() {
|
|
|
|
const { style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<KeyboardAwareScrollView
|
|
|
|
{...scrollPersistTaps}
|
|
|
|
style={style}
|
|
|
|
contentContainerStyle={contentContainerStyle}
|
|
|
|
scrollEnabled={scrollEnabled}
|
|
|
|
alwaysBounceVertical={false}
|
2021-11-10 15:10:34 +00:00
|
|
|
extraHeight={keyboardVerticalOffset}>
|
2021-09-13 20:41:05 +00:00
|
|
|
{children}
|
|
|
|
</KeyboardAwareScrollView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|