mirror of
https://github.com/danog/react-datalist-input.git
synced 2024-12-03 18:07:55 +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 );
|
||||||
} );
|
} );
|
||||||
this.setState( {
|
if( matchingItems.length > 0) {
|
||||||
currentInput,
|
this.setState( {
|
||||||
matchingItems,
|
currentInput,
|
||||||
focusIndex: 0,
|
matchingItems,
|
||||||
visible: true,
|
focusIndex: 0,
|
||||||
} );
|
visible: true,
|
||||||
|
} );
|
||||||
|
} else {
|
||||||
|
his.setState( { currentInput } )
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user