Skip to content

Commit 06a814a

Browse files
committed
PickerAvoidingView: Add enabled property
1 parent 9349af4 commit 06a814a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/PickerAvoidingView/index.ios.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ export function PickerAvoidingView(props) {
3737
}
3838
}, [isPickerOpen]);
3939

40-
return (
41-
<View
42-
style={StyleSheet.compose(props.style, {
43-
paddingBottom: shouldAddSpace ? IOS_MODAL_HEIGHT : 0,
44-
})}
45-
>
46-
{props.children}
47-
</View>
48-
);
40+
const style = props.enabled
41+
? StyleSheet.compose(props.style, {
42+
paddingBottom: shouldAddSpace ? IOS_MODAL_HEIGHT : 0,
43+
})
44+
: props.style;
45+
46+
return <View style={style}>{props.children}</View>;
4947
}
48+
49+
PickerAvoidingView.defaultProps = {
50+
enabled: true,
51+
};

src/PickerAvoidingView/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ import { View } from 'react-native';
99
* within the PickerAvoidingView.
1010
*/
1111
export function PickerAvoidingView(props) {
12-
return <View {...props}>{props.children}</View>;
12+
// eslint-disable-next-line no-unused-vars
13+
const { enabled, ...viewProps } = props;
14+
return <View {...viewProps}>{props.children}</View>;
1315
}

0 commit comments

Comments
 (0)