Skip to content

Commit eb93465

Browse files
lucswartethanshar
andauthored
Add overlayBackground and able to change search Icon. (#1570)
* Add overlayBackground and able to change search Icon. * overlayBackgroundColor => pickerModalProps * Spread all of the props Co-authored-by: Ethan Sharabi <[email protected]> Co-authored-by: Ethan Sharabi <[email protected]>
1 parent d2890f9 commit eb93465

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/components/picker/PickerModal.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ class PickerModal extends BaseComponent {
2121
searchStyle: PropTypes.shape({
2222
color: PropTypes.string,
2323
placeholderTextColor: PropTypes.string,
24-
selectionColor: PropTypes.string
24+
selectionColor: PropTypes.string,
25+
icon: PropTypes.object
2526
}),
2627
searchPlaceholder: PropTypes.string,
2728
onSearchChange: PropTypes.func,
2829
renderCustomSearch: PropTypes.elementType,
29-
listProps: PropTypes.object
30+
listProps: PropTypes.object,
31+
pickerModalProps: PropTypes.object
3032
};
3133

3234
static defaultProps = {
@@ -55,7 +57,7 @@ class PickerModal extends BaseComponent {
5557

5658
return (
5759
<View style={this.styles.searchInputContainer}>
58-
<Image style={this.styles.searchIcon} source={Assets.icons.search}/>
60+
<Image style={this.styles.searchIcon} source={searchStyle.icon || Assets.icons.search}/>
5961
<TextInput
6062
testID={testID}
6163
ref={r => (this.search = r)}
@@ -78,7 +80,7 @@ class PickerModal extends BaseComponent {
7880
};
7981

8082
render() {
81-
const {visible, enableModalBlur, topBarProps, listProps, children, onShow} = this.props;
83+
const {visible, enableModalBlur, topBarProps, listProps, children, onShow, pickerModalProps} = this.props;
8284
return (
8385
<Modal
8486
animationType={'slide'}
@@ -87,6 +89,7 @@ class PickerModal extends BaseComponent {
8789
visible={visible}
8890
onRequestClose={topBarProps.onCancel}
8991
onShow={onShow}
92+
{...pickerModalProps}
9093
>
9194
<Modal.TopBar {...topBarProps}/>
9295
{this.renderSearchInput()}

src/components/picker/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ class Picker extends Component {
144144
/**
145145
* Pass props to the list component that wraps the picker options (allows to control FlatList behavior)
146146
*/
147-
listProps: PropTypes.object
147+
listProps: PropTypes.object,
148+
/**
149+
* Pass props to the picker modal
150+
*/
151+
pickerModalProps: PropTypes.object
148152
};
149153

150154
static defaultProps = {
@@ -365,7 +369,8 @@ class Picker extends Component {
365369
renderCustomModal,
366370
listProps,
367371
children,
368-
testID
372+
testID,
373+
pickerModalProps
369374
} = this.props;
370375
const {showExpandableModal, selectedItemPosition, value} = this.state;
371376

@@ -407,6 +412,7 @@ class Picker extends Component {
407412
renderCustomSearch={renderCustomSearch}
408413
listProps={listProps}
409414
onShow={onShow}
415+
pickerModalProps={pickerModalProps}
410416
>
411417
{this.children}
412418
</PickerModal>

0 commit comments

Comments
 (0)