Skip to content

Commit ae32675

Browse files
committed
PickerAvoidingView: Add enabled property
1 parent a68f09f commit ae32675

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { View } from "react-native";
2+
import { View } from 'react-native';
33

44
/**
55
* As, currently, only on iOS the picker's modal resembles the software keyboard
@@ -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)