mirror of
https://github.com/danog/react-datalist-input.git
synced 2024-12-02 17:37:50 +01:00
prevent undefined on no matching elements
This commit is contained in:
parent
352eba6643
commit
593c9e6cd4
@ -32,12 +32,16 @@ class DataListInput extends React.Component {
|
||||
if ( typeof ( match ) === typeof ( Function ) ) { return match( currentInput, item ); }
|
||||
return this.match( currentInput, item );
|
||||
} );
|
||||
this.setState( {
|
||||
currentInput,
|
||||
matchingItems,
|
||||
focusIndex: 0,
|
||||
visible: true,
|
||||
} );
|
||||
if( matchingItems.length > 0) {
|
||||
this.setState( {
|
||||
currentInput,
|
||||
matchingItems,
|
||||
focusIndex: 0,
|
||||
visible: true,
|
||||
} );
|
||||
} else {
|
||||
his.setState( { currentInput } )
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user