Skip to content

Commit 29d0797

Browse files
authored
added reset search when modal is dismissed (#873)
1 parent 53ff001 commit 29d0797

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/picker/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class Picker extends BaseComponent {
215215

216216
toggleExpandableModal = value => {
217217
this.setState({showExpandableModal: value});
218+
this.clearSearchField();
218219
};
219220

220221
toggleItemSelection = item => {
@@ -235,7 +236,9 @@ class Picker extends BaseComponent {
235236
};
236237

237238
onDoneSelecting = item => {
238-
this.setState({searchValue: '', value: item}); // clean search when done selecting
239+
this.clearSearchField();
240+
241+
this.setState({value: item});
239242
this.toggleExpandableModal(false);
240243
_.invoke(this.props, 'onChange', item);
241244
};
@@ -255,6 +258,10 @@ class Picker extends BaseComponent {
255258
this.setState({selectedItemPosition: y});
256259
};
257260

261+
clearSearchField = () => {
262+
this.setState({searchValue: ''});
263+
}
264+
258265
appendPropsToChildren = () => {
259266
const {children, mode, getItemValue, getItemLabel, showSearch, renderItem} = this.props;
260267
const {value, searchValue} = this.state;

0 commit comments

Comments
 (0)