max input length now works with default match function on input click

This commit is contained in:
Andre Landgraf 2019-06-17 11:31:46 +02:00
parent 0e4e12eb05
commit cdfa4c5124
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "react-datalist-input",
"version": "1.1.26",
"version": "1.1.27",
"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

@ -74,7 +74,7 @@ class DataListInput extends React.Component {
const currentInputIsLastItem =
!clearInputOnSelect && lastValidItem && lastValidItem.label === currentInput;
const displayableItems = matchingItems.length && !currentInputIsLastItem
? matchingItems : items.slice( 0, dropDownLength );
? matchingItems.slice( 0, dropDownLength ) : items.slice( 0, dropDownLength );
let index = lastValidItem && !clearInputOnSelect
? this.indexOfItem( lastValidItem, displayableItems ) : 0;