From e6499a4775fbbf483d1785ab333f690144959e32 Mon Sep 17 00:00:00 2001 From: Charles Lee Date: Fri, 5 Jan 2018 10:22:54 +1100 Subject: [PATCH] added internal method for clearing state called setInputValue --- src/Select.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Select.js b/src/Select.js index 55baf023fd..3c40175f13 100644 --- a/src/Select.js +++ b/src/Select.js @@ -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);