Skip to content

Commit

Permalink
Merge pull request #110 from sag1v/rtl-swipe
Browse files Browse the repository at this point in the history
fix rtl swipe
  • Loading branch information
sag1v authored Nov 15, 2020
2 parents a74b418 + 22d6eff commit 6f3626c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/react-elastic-carousel/components/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,18 @@ class Carousel extends React.Component {
// bail out of state update
return;
}
let swipedSliderPosition;
if (horizontalSwipe) {
if (isRTL) {
swipedSliderPosition = sliderPosition + deltaX;
} else {
swipedSliderPosition = sliderPosition - deltaX;
}
} else {
swipedSliderPosition = sliderPosition - deltaY;
}
return {
swipedSliderPosition: horizontalSwipe
? sliderPosition - deltaX
: sliderPosition - deltaY,
swipedSliderPosition,
isSwiping: true,
transitioning: true
};
Expand Down

0 comments on commit 6f3626c

Please sign in to comment.