dohooo / react-native-reanimated-carousel

🎠 React Native swiper/carousel component, fully implemented using reanimated v2, support to iOS/Android/Web. (Swiper/Carousel)
https://react-native-reanimated-carousel.vercel.app
MIT License
2.85k stars 329 forks source link

When swiping past the beginning (left) or end (right) of a carousel with `mode="parallax"` and `loop={false}`, `onSnapToItem` is not triggering, and `onProgressChange` returns an `absoluteProgress` of greater than 1 #158

Closed tsalama closed 2 years ago

tsalama commented 2 years ago

Hello! Firstly, I wanted to say thank you for this amazing library!

With that, I would like to report a bug.

To Reproduce Steps to reproduce the behavior:

When the carousel is used with the following props, swiping past the beginning (left) or end (right) of the carousel does NOT trigger onSnapToItem, and onProgressChange can return an absoluteProgress of greater than 1 --- the latter produces unexpected behavior for progress bars / pagination dots.

mode="parallax"
loop={false}
pagingEnabled={false}

The value for snapEnabled do not seem to affect this behavior for the second issue. For the first issue, I'm aware that onSnapToItem is not called at all in general when both pagingEnabled and snapEnabled are false.

Expected behavior

Versions (please complete the following information):

Smartphone (please complete the following information):

dohooo commented 2 years ago

Thanks for reminding me to fix it ASAP.

dohooo commented 2 years ago

onProgressChange should not return an absoluteProgress that is greater than 1 when swiping past the beginning or end of the carousel.

It fixed in the latest version.

onSnapToItem should always be called even if swiping past the beginning or end of the carousel (since the first or last element are eventually snapped to)

And this question, I think u should use onScrollEnd prop.

image
Boubaker93 commented 10 months ago

I'm still having this issue with onScrollEnd not triggering when swiping to the beginning or end with mode="parallax"and loop={false}

react-native version: 0.72.6 react-native-reanimated version: 3.6.1 react-native-reanimated-carousel version: 3.5.1

AMerkuri commented 8 months ago

Same issue, onScrollEnd and onSnapToItem not triggering with loop={false}

    "react-native": "0.73.6",
    "react-native-reanimated": "~3.6.2",
    "react-native-reanimated-carousel": "^3.5.1",