Skip to content

Commit

Permalink
added internal method for clearing state called setInputValue
Browse files Browse the repository at this point in the history
  • Loading branch information
gwyneplaine committed Jan 4, 2018
1 parent e66f256 commit e6499a4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,18 @@ class Select extends React.Component {
});
}

setInputValue(newValue) {
if (this.props.onInputChange) {
let nextState = this.props.onInputChange(newValue);
if (nextState != null && typeof nextState !== 'object') {
newValue = '' + nextState;
}
}
this.setState({
inputValue: newValue
});
}

handleInputValueChange(newValue) {
if (this.props.onInputChange) {
let nextState = this.props.onInputChange(newValue);
Expand Down

0 comments on commit e6499a4

Please sign in to comment.