Skip to content

Commit 40c900d

Browse files
committed
Apply PR suggestions #1
Code additions/edits
1 parent 5dc57c3 commit 40c900d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/PickerAvoidingView/index.ios.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
22
import { StyleSheet, View } from 'react-native';
33
import { PickerStateContext } from '../PickerStateProvider';
44
import { IOS_MODAL_HEIGHT } from '../constants';
5+
import PropTypes from 'prop-types';
56

67
/**
78
* PickerAvoidingView is a React component that adjusts the view layout to avoid
@@ -16,12 +17,17 @@ import { IOS_MODAL_HEIGHT } from '../constants';
1617
* protected from obstruction by the picker modal
1718
*/
1819
export class PickerAvoidingView extends Component {
20+
static propTypes = {
21+
enabled: PropTypes.bool,
22+
};
23+
1924
static defaultProps = {
2025
enabled: true,
2126
};
2227

2328
render() {
24-
const { enabled, style, children, ...otherProps } = this.props;
29+
const { enabled, style, ...viewProps } = this.props;
30+
2531
return (
2632
<PickerStateContext.Consumer>
2733
{(context) => {
@@ -32,11 +38,7 @@ export class PickerAvoidingView extends Component {
3238
})
3339
: style;
3440

35-
return (
36-
<View style={effectiveStyle} {...otherProps}>
37-
{children}
38-
</View>
39-
);
41+
return <View style={effectiveStyle} {...viewProps} />;
4042
}}
4143
</PickerStateContext.Consumer>
4244
);

src/PickerAvoidingView/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ import { View } from 'react-native';
1111
export function PickerAvoidingView(props) {
1212
// eslint-disable-next-line no-unused-vars
1313
const { enabled, ...viewProps } = props;
14-
return <View {...viewProps}>{props.children}</View>;
14+
return <View {...viewProps} />;
1515
}

0 commit comments

Comments
 (0)