fmoo / react-typeahead

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

Reset input value onOptionSelected #116

Closed nicoecheza closed 9 years ago

nicoecheza commented 9 years ago

Hi, I'm trying to reset the value of the input after an option is selected. Is there an easy way to solve this? thanks!

Semigradsky commented 9 years ago

Looks like setEntryText method can be used for this purpose.

  ...
  onSelect(item) {
    this.refs.typeahead.setEntryText('');
  },

  render() {
    return (
      <Typeahead
        ref="typeahead"
        onOptionSelected={this.onSelect}
        ...
nicoecheza commented 9 years ago

Thanks, this worked.