moxystudio / react-carousel

A React carousel component that aims to be as flexible as possible
MIT License
14 stars 3 forks source link

feat: swap slides based on drag movement #12

Closed paulobmarcos closed 4 years ago

paulobmarcos commented 4 years ago

The Problem

In some cases , the drag movement wouldn't be enough to change the current slide. This created a bounce back effect even though the user was expecting the slide to change to an adjacent one.

The Solution

We are now seeing the direction of the drag movement and based on that we change the slide to the previous/next one based on it.

Although, if the drag movement is enough to change the current slide, we respect that and we keep the original behavior.

This is now the default behavior but can be set on and off with a prop: swapOnDragMoveEnd