fix scrollDirection when direction is RTL #690
Merged
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.
To determine the
scrollDirection
in the_onScrollHorizontal
method it compares the previous state'sscrollOffset
with the currentscrollLeft
value of the target. For browsers whose "RTLOffsetType" is "negative", this results in thescrollDirection
being set to "backward".The
scrollOffset
state value has been converted to a positive number or zero, and thescrollLeft
value of the target (when "RTLOffsetType" is "negative") is a negative number. When comparingprevState.scrollOffset < scrollLeft
it is always false because a positive value or zero is never greater than a negative value.Proposed fix: compare
prevState.scrollOffset < scrollOffset
becausescrollOffset
has already been transformed in the same way thatprevState.scrollOffset
was transformed.This pull request is intended to address this bug #689.