Rocket.Chat.ReactNative/app/presentation/KeyboardView.js

38 lines
981 B
JavaScript
Raw Normal View History

2017-08-09 13:12:00 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import scrollPersistTaps from '../utils/scrollPersistTaps';
2017-08-09 13:12:00 +00:00
export default class KeyboardView extends React.PureComponent {
static propTypes = {
style: PropTypes.any,
contentContainerStyle: PropTypes.any,
2017-08-09 13:12:00 +00:00
keyboardVerticalOffset: PropTypes.number,
scrollEnabled: PropTypes.bool,
2017-08-09 16:19:17 +00:00
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
])
2017-08-09 13:12:00 +00:00
}
render() {
const {
style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children
} = this.props;
2017-08-09 13:12:00 +00:00
return (
<KeyboardAwareScrollView
{...scrollPersistTaps}
style={style}
contentContainerStyle={contentContainerStyle}
scrollEnabled={scrollEnabled}
alwaysBounceVertical={false}
extraHeight={keyboardVerticalOffset}
behavior='position'
>
{children}
</KeyboardAwareScrollView>
2017-08-09 13:12:00 +00:00
);
}
}