set '' as well

This commit is contained in:
Andre Landgraf 2019-06-20 00:01:16 +02:00
parent bfaf980d4a
commit aad04be942
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"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.",
"main": "./lib/DataListInput.js",
"license": "MIT",

View File

@ -62,7 +62,8 @@ class DataListInput extends React.Component {
}
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 reachedRequiredLength = currentInput.length >= requiredInputLength;
@ -70,8 +71,9 @@ class DataListInput extends React.Component {
// the user most likely wants to clear the input field
if ( initialValue && currentInput === initialValue ) {
this.setState( { currentInput: '' } );
currentInput = '';
}
if ( reachedRequiredLength && !visible ) {
const matchingItems = items.filter( ( item ) => {