Open invious opened 6 years ago
something like this?
<AsyncTypeahead
onSearch={this._handleSearch}
searchOptions={this._handleSort}
...
_handleSort = (value, options) => {
let sorter = (a, b) => {
let distance = this.levenshtein.get(a.name, value) - this.levenshtein.get(b.name, value)
console.log(`a:${a.name}, b:${b.name}, input:${value}`)
return distance;
}
return options.sort(sorter)
}
it doesn't seem like the sorter function is ever getting called
I have this function which
How can I make it so that the results are sorted by this function as I type in the AsyncTypeAhead