From 7ff7dc10738ad9ff551c8765c17040beb78c31e5 Mon Sep 17 00:00:00 2001 From: Danny Wolf Date: Mon, 16 May 2016 09:58:03 -0400 Subject: [PATCH] Add clearSelectionIndex method so calling ._onEscape() is not necessary to clear selectionIndex --- README.md | 8 ++++++++ src/typeahead/index.js | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index e04ce55c..fe753361 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,14 @@ If true, options will still be rendered when there is no value. Focuses the typeahead input. +#### typeahead.setEntryText(value) + +Sets the value of the input field to `value`. + +#### typeahead.clearSelectionIndex + +Clears the currently selected option index. + --- ### Tokenizer(props) diff --git a/src/typeahead/index.js b/src/typeahead/index.js index a33d285e..dee2def1 100644 --- a/src/typeahead/index.js +++ b/src/typeahead/index.js @@ -202,6 +202,10 @@ var Typeahead = React.createClass({ }, _onEscape: function() { + this.clearSelectionIndex(); + }, + + clearSelectionIndex: function() { this.setState({ selectionIndex: null });