Skip to content

Add overlayBackground and able to change search Icon. #1570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/components/picker/PickerModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ class PickerModal extends BaseComponent {
searchStyle: PropTypes.shape({
color: PropTypes.string,
placeholderTextColor: PropTypes.string,
selectionColor: PropTypes.string
selectionColor: PropTypes.string,
icon: PropTypes.object
}),
searchPlaceholder: PropTypes.string,
onSearchChange: PropTypes.func,
renderCustomSearch: PropTypes.elementType,
listProps: PropTypes.object
listProps: PropTypes.object,
overlayBackgroundColor: PropTypes.string
};

static defaultProps = {
Expand Down Expand Up @@ -55,7 +57,7 @@ class PickerModal extends BaseComponent {

return (
<View style={this.styles.searchInputContainer}>
<Image style={this.styles.searchIcon} source={Assets.icons.search}/>
<Image style={this.styles.searchIcon} source={searchStyle.icon || Assets.icons.search}/>
<TextInput
testID={testID}
ref={r => (this.search = r)}
Expand All @@ -78,7 +80,7 @@ class PickerModal extends BaseComponent {
};

render() {
const {visible, enableModalBlur, topBarProps, listProps, children, onShow} = this.props;
const {visible, enableModalBlur, topBarProps, listProps, children, onShow, overlayBackgroundColor} = this.props;
return (
<Modal
animationType={'slide'}
Expand All @@ -87,6 +89,7 @@ class PickerModal extends BaseComponent {
visible={visible}
onRequestClose={topBarProps.onCancel}
onShow={onShow}
overlayBackgroundColor={overlayBackgroundColor}
>
<Modal.TopBar {...topBarProps}/>
{this.renderSearchInput()}
Expand Down
10 changes: 8 additions & 2 deletions src/components/picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ class Picker extends Component {
/**
* Pass props to the list component that wraps the picker options (allows to control FlatList behavior)
*/
listProps: PropTypes.object
listProps: PropTypes.object,
/**
* Pass a custom background color to the modal picker.
*/
overlayBackgroundColor: PropTypes.string
};

static defaultProps = {
Expand Down Expand Up @@ -365,7 +369,8 @@ class Picker extends Component {
renderCustomModal,
listProps,
children,
testID
testID,
overlayBackgroundColor
} = this.props;
const {showExpandableModal, selectedItemPosition, value} = this.state;

Expand Down Expand Up @@ -407,6 +412,7 @@ class Picker extends Component {
renderCustomSearch={renderCustomSearch}
listProps={listProps}
onShow={onShow}
overlayBackgroundColor={overlayBackgroundColor}
>
{this.children}
</PickerModal>
Expand Down