File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React, { Component } from 'react';
2
2
import { StyleSheet , View } from 'react-native' ;
3
3
import { PickerStateContext } from '../PickerStateProvider' ;
4
4
import { IOS_MODAL_HEIGHT } from '../constants' ;
5
+ import PropTypes from 'prop-types' ;
5
6
6
7
/**
7
8
* PickerAvoidingView is a React component that adjusts the view layout to avoid
@@ -16,12 +17,17 @@ import { IOS_MODAL_HEIGHT } from '../constants';
16
17
* protected from obstruction by the picker modal
17
18
*/
18
19
export class PickerAvoidingView extends Component {
20
+ static propTypes = {
21
+ enabled : PropTypes . bool ,
22
+ } ;
23
+
19
24
static defaultProps = {
20
25
enabled : true ,
21
26
} ;
22
27
23
28
render ( ) {
24
- const { enabled, style, children, ...otherProps } = this . props ;
29
+ const { enabled, style, ...viewProps } = this . props ;
30
+
25
31
return (
26
32
< PickerStateContext . Consumer >
27
33
{ ( context ) => {
@@ -32,11 +38,7 @@ export class PickerAvoidingView extends Component {
32
38
} )
33
39
: style ;
34
40
35
- return (
36
- < View style = { effectiveStyle } { ...otherProps } >
37
- { children }
38
- </ View >
39
- ) ;
41
+ return < View style = { effectiveStyle } { ...viewProps } /> ;
40
42
} }
41
43
</ PickerStateContext . Consumer >
42
44
) ;
Original file line number Diff line number Diff line change @@ -11,5 +11,5 @@ import { View } from 'react-native';
11
11
export function PickerAvoidingView ( props ) {
12
12
// eslint-disable-next-line no-unused-vars
13
13
const { enabled, ...viewProps } = props ;
14
- return < View { ...viewProps } > { props . children } </ View > ;
14
+ return < View { ...viewProps } / >;
15
15
}
You can’t perform that action at this time.
0 commit comments