prevent undefined on no matching elements

This commit is contained in:
Andre Landgraf 2019-06-13 18:01:07 +02:00
parent 352eba6643
commit 593c9e6cd4

View File

@ -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 );
} ); } );
this.setState( { if( matchingItems.length > 0) {
currentInput, this.setState( {
matchingItems, currentInput,
focusIndex: 0, matchingItems,
visible: true, focusIndex: 0,
} ); visible: true,
} );
} else {
his.setState( { currentInput } )
}
}; };
/** /**