Fix misuse of second argument as nextState (the actual argument is prevState) #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am working on a horizontal timeline that uses
react-tiny-virtual-list
to reduce the amount of items rendered at any one time. Clicking on an item on this timeline should center it horizontally. I noticed that when clicking on an item after scrolling, the item would not center.This fixes instances where, right after scrolling, a change in the
scrollToIndex
prop will not actually scroll to the item at the passed index correctly. This is due to thecomponentDidUpdate
method considering the previous state to actually be the next state and looking atscrollChangeReason
on it, seeing the oldscrollChangeReason
caused by the user scrolling, thus not callingscrollTo
to actually center the element.