Skip to content

Commit

Permalink
fix(dropdown): Fix a bug in autocomplete dropdown active state
Browse files Browse the repository at this point in the history
  • Loading branch information
hibiken committed Jul 13, 2016
1 parent 29310e4 commit 29b0bba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/PlacesAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ class PlacesAutocomplete extends React.Component {
}

_getActiveItem() {
return this.state.autocompleteItems.find(item => item.index === index)
return this.state.autocompleteItems.find(item => item.active)
}

_selectActiveItemAtIndex(index) {
const activeItem = this._getActiveItem()
const activeName = this.state.autocompleteItems.find(item => item.index === index).suggestion
this._setActiveItemAtIndex(index)
this.props.onChange(activeItem.suggestion)
this.props.onChange(activeName)
}

_handleEnterKey() {
Expand Down

0 comments on commit 29b0bba

Please sign in to comment.