mirror of
https://github.com/danog/react-datalist-input.git
synced 2024-12-04 10:28:19 +01:00
set '' as well
This commit is contained in:
parent
bfaf980d4a
commit
aad04be942
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-datalist-input",
|
"name": "react-datalist-input",
|
||||||
"version": "1.1.34",
|
"version": "1.1.35",
|
||||||
"description": "This package provides a react component as follows: an input field with a drop down menu to pick a possible option based on the current input.",
|
"description": "This package provides a react component as follows: an input field with a drop down menu to pick a possible option based on the current input.",
|
||||||
"main": "./lib/DataListInput.js",
|
"main": "./lib/DataListInput.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -62,7 +62,8 @@ class DataListInput extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClickInput = () => {
|
onClickInput = () => {
|
||||||
const { currentInput, visible, lastValidItem } = this.state;
|
const { visible, lastValidItem } = this.state;
|
||||||
|
let { currentInput } = this.state;
|
||||||
const { requiredInputLength, dropDownLength, items, match, clearInputOnSelect, initialValue } = this.props;
|
const { requiredInputLength, dropDownLength, items, match, clearInputOnSelect, initialValue } = this.props;
|
||||||
const reachedRequiredLength = currentInput.length >= requiredInputLength;
|
const reachedRequiredLength = currentInput.length >= requiredInputLength;
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ class DataListInput extends React.Component {
|
|||||||
// the user most likely wants to clear the input field
|
// the user most likely wants to clear the input field
|
||||||
if ( initialValue && currentInput === initialValue ) {
|
if ( initialValue && currentInput === initialValue ) {
|
||||||
this.setState( { currentInput: '' } );
|
this.setState( { currentInput: '' } );
|
||||||
|
currentInput = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( reachedRequiredLength && !visible ) {
|
if ( reachedRequiredLength && !visible ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user