react-responsive-carousel icon indicating copy to clipboard operation
react-responsive-carousel copied to clipboard

[Feature request]: Update swipe behaviour with centerMode

Open LobodaAndreyEK opened this issue 3 years ago • 0 comments

As you know, it's possible to use this library as a slider with multiple slides showing at the same time (with centerMode ON + setting percentages for amount of active slides). It works awesome unless we try to swipe it.

What happening now is you can swipe it for a 10+ slides per time, but the value will change only once so you will 'rolling back' to that slide.

Steps to reproduce the behavior:

  1. Make a standard slider with 20+ items (slides)
  2. turn on center mode and for example show 5 items (by setting centerSlidePercentage = 20)
  3. Try to swipe for a 5-10 items per one event
  4. You will be moved back into '+1' slide

Expected behavior I see 2 options, which could improve existing behaviour:

  1. When 'onSwipeEnd' event fired, we could get the index of the central element as the second argument, so we can update 'active' index by ourselves.
  2. Allow swiping with no updating of the currentItem (so you have to click on item after swipe to make it selected)

TY in advance, ur lib rocks!

LobodaAndreyEK avatar Jul 19 '22 13:07 LobodaAndreyEK