mirror of
https://github.com/danog/react-datalist-input.git
synced 2024-12-03 09:57:50 +01:00
set '' as well
This commit is contained in:
parent
bfaf980d4a
commit
aad04be942
@ -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",
|
||||
|
@ -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 ) => {
|
||||
|
Loading…
Reference in New Issue
Block a user