fmoo / react-typeahead

Pure react-based typeahead and typeahead-tokenizer
ISC License
677 stars 230 forks source link

Click outside must close suggestions. #241

Open divined opened 6 years ago

divined commented 6 years ago

Click outside must close suggestions.

How to?

divined commented 6 years ago

After any page updates suggestions are opens again (((

Why not focused element show suggestions? Please add rules to showResults:

  1. entryValue in_array searchResults and searchResults.length == 1 > hide
  2. isFocused == false > hide
faultables commented 6 years ago

On my project I use this concept:

abdallahokasha commented 6 years ago

simiply, we can set showResults to false on _onBlur Function

this.setState({isFocused: false, showResults: false}, function () {

instead of just,

this.setState({isFocused: false }, function () {

it works with me :smile: