fmoo / react-typeahead

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

Add clearSelectionIndex method #193

Open wolfd opened 8 years ago

wolfd commented 8 years ago

Adds clearSelection method so calling _onEscape is not necessary to clear selectionIndex.

I had a need to clear the selection index, and unless I'm not seeing something, I only found the _onEscape method to be able to do that.

Also added short blurb on the setEntryText method to README.md.

wolfd commented 8 years ago

Also, @fmoo, what do you think adding a prop that allows you to map any key to any action?

There are a few locations that I've wanted to customize the behavior of the plugin's keybindings (making the tab key not necessarily select an option, but only move down the list, and a few others.) I would rather make react-typeahead extremely flexible and generalized so it can meet the needs of all sorts of users.

wolfd commented 8 years ago

I also realized that you can use a ref and setState outside the component to do this. It's not great, but it works.