mirror of
https://github.com/danog/react-datalist-input.git
synced 2024-12-11 00:49:44 +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 ); }
|
if ( typeof ( match ) === typeof ( Function ) ) { return match( currentInput, item ); }
|
||||||
return this.match( currentInput, item );
|
return this.match( currentInput, item );
|
||||||
} );
|
} );
|
||||||
|
if( matchingItems.length > 0) {
|
||||||
this.setState( {
|
this.setState( {
|
||||||
currentInput,
|
currentInput,
|
||||||
matchingItems,
|
matchingItems,
|
||||||
focusIndex: 0,
|
focusIndex: 0,
|
||||||
visible: true,
|
visible: true,
|
||||||
} );
|
} );
|
||||||
|
} else {
|
||||||
|
his.setState( { currentInput } )
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user