Merge pull request #411 from orangemug/fix/autocomplete-only-autocomplete-strings

Stop autocomplete crashing the editor
This commit is contained in:
Orange Mug 2018-10-12 19:24:35 +01:00 committed by GitHub
commit 906d7ac3d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,8 +69,10 @@ class AutocompleteInput extends React.Component {
getItemValue={(item) => item[0]}
onSelect={v => this.props.onChange(v)}
onChange={(e, v) => this.props.onChange(v)}
shouldItemRender={(item, value) => {
return item[0].toLowerCase().indexOf(value.toLowerCase()) > -1
shouldItemRender={(item, value="") => {
if (typeof(value) === "string") {
return item[0].toLowerCase().indexOf(value.toLowerCase()) > -1
}
}}
renderItem={(item, isHighlighted) => (
<div