Skip to content

Commit

Permalink
fix(scroll): replace state with getState in shouldScroll (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
silviuaavram authored Feb 26, 2019
1 parent 984f8f9 commit abafc98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/downshift.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,11 +1106,11 @@ class Downshift extends Component {

shouldScroll(prevState, prevProps) {
const {highlightedIndex: currentHighlightedIndex} =
this.props.highlightedIndex === undefined ? this.state : this.props
this.props.highlightedIndex === undefined ? this.getState() : this.props
const {highlightedIndex: prevHighlightedIndex} =
prevProps.highlightedIndex === undefined ? prevState : prevProps
const scrollWhenOpen =
currentHighlightedIndex && this.state.isOpen && !prevState.isOpen
currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen
const scrollWhenNavigating =
currentHighlightedIndex !== prevHighlightedIndex

Expand Down

0 comments on commit abafc98

Please sign in to comment.