forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.android.js
32 lines (28 loc) · 1.06 KB
/
index.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import {View, KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native';
import _ from 'underscore';
import PropTypes from 'prop-types';
const propTypes = {
/** In most cases, we do not need to use KeyboardAvoidingView on Android, so it is set to false by default. */
shouldApplyToAndroid: PropTypes.bool,
};
const defaultProps = {
shouldApplyToAndroid: false,
};
const KeyboardAvoidingView = (props) => {
if (props.shouldApplyToAndroid) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<KeyboardAvoidingViewComponent {...props} />
);
}
const viewProps = _.omit(props, ['behavior', 'contentContainerStyle', 'enabled', 'keyboardVerticalOffset']);
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<View {...viewProps} />
);
};
KeyboardAvoidingView.displayName = 'KeyboardAvoidingView';
KeyboardAvoidingView.propTypes = propTypes;
KeyboardAvoidingView.defaultProps = defaultProps;
export default KeyboardAvoidingView;