fmoo / react-typeahead

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

Don't render selector if there are no options to display #156

Closed vrunjeti closed 8 years ago

vrunjeti commented 8 years ago

I originally had the issue of the selector being displayed even when there are no options.

screenshot 2016-01-22 21 38 53

If I am not allowing custom values and type something with no suggestions, the selector is displayed even when the input isn't focused:

screenshot 2016-01-22 21 40 59

I changed it so that the selector component won't display if there are no options available and custom values aren't allowed. I had to send allowCustomValues as a prop because it wasn't possible to distinguish whether custom values were allowed or not with the existing customValue prop alone. The value of null for customValue can mean that custom values aren't allowed, the current input has less characters than specified, or the input matches an existing option.