Skip to content

Commit

Permalink
Fix #1159: CollectionView scrollTop/scrollLeft
Browse files Browse the repository at this point in the history
Props scrollTop/scrollLeft are only applied to CollectionView when
this.state.scrollPositionChangeReason is REQUESTED, but
getDerivedStateFromProps was not setting scrollPositionChangeReason.
This meant that these props were not being applied to the view.
  • Loading branch information
dawnmist committed Jun 17, 2020
1 parent 9ce12be commit f40bc0d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/Collection/CollectionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class CollectionView extends React.PureComponent {
return {
scrollLeft: 0,
scrollTop: 0,
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED,
};
} else if (
nextProps.scrollLeft !== prevState.scrollLeft ||
Expand All @@ -207,6 +208,7 @@ class CollectionView extends React.PureComponent {
nextProps.scrollTop != null
? nextProps.scrollTop
: prevState.scrollTop,
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED,
};
}

Expand Down

0 comments on commit f40bc0d

Please sign in to comment.