fmoo / react-typeahead

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

Add onChange, onKeyUp, onFocus, and onBlur event to Typeahead #68

Closed leesiongchan closed 9 years ago

fmoo commented 9 years ago

can you rebase/merge with master? I merged another PR and it seems to have created a conflict.

fmoo commented 9 years ago

Ok, so just out of curiosity, did you have any specific use-cases for all of these?

I've actually been looking to try provide a simplified set of events/callbacks, such as deprecating onKeyDown in favor of onChange, and implicitly invoking onChange on the entry state changes in realtime. Thoughts?

leesiongchan commented 9 years ago

In my case, I am using onKeyUp to invokes the search function and onChange to updates other state variables. And I think it's important to remain all the common events as Typeahead should be only a wrapper of normal input field with the capability of doing autocomplete.

claydiffrient commented 9 years ago

Any update on this @fmoo ? I'm trying to load data via async and as part of that I need to be able to determine what the user has typed in. I'm currently hooking into the onKeyDown event, but because doing event.target.value at that point returns the value without the latest keypress in place. It would be nice to have onChange or onKeyUp to be able to get a more accurate indication of what the user has typed so that my async search can be improved.

fmoo commented 9 years ago

Hi @claydiffrient

I just merged this and did a 1.0.6 release if you need this in prod.

claydiffrient commented 9 years ago

Sweet @fmoo! Thanks so much!