35 lines
984 B
JavaScript
35 lines
984 B
JavaScript
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import { ViewPropTypes } from 'react-native';
|
||
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
||
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
||
|
|
||
|
export default class KeyboardView extends React.PureComponent {
|
||
|
static propTypes = {
|
||
|
style: ViewPropTypes.style,
|
||
|
contentContainerStyle: ViewPropTypes.style,
|
||
|
keyboardVerticalOffset: PropTypes.number,
|
||
|
scrollEnabled: PropTypes.bool,
|
||
|
children: PropTypes.oneOfType([
|
||
|
PropTypes.arrayOf(PropTypes.node),
|
||
|
PropTypes.node
|
||
|
])
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
return (
|
||
|
<KeyboardAwareScrollView
|
||
|
{...scrollPersistTaps}
|
||
|
style={this.props.style}
|
||
|
contentContainerStyle={this.props.contentContainerStyle}
|
||
|
scrollEnabled={this.props.scrollEnabled}
|
||
|
alwaysBounceVertical={false}
|
||
|
extraHeight={this.props.keyboardVerticalOffset}
|
||
|
behavior='position'
|
||
|
>
|
||
|
{this.props.children}
|
||
|
</KeyboardAwareScrollView>
|
||
|
);
|
||
|
}
|
||
|
}
|