React native snap carousel no pause between slides

3.6k Views Asked by At

Sorry for my title, I didn't know how to explain it. So, I'm using React-native-snap-carousel (3.9.1) on my EXPO application to add a simple carousel.

When I slide between slides, there is no wait / pause. With a fast swipe I can go directly to the last slide. But I want to make a break between slide and swipe again to go to the next slide.

The problem appear only on my device : Honor 20 / Android 10 I haven't any problem with some others devices like S10, or IOS divices.

Here is my carousel code :

<Carousel
    ref={carouselRef}
    keyExtractor={carouselKE}
    data={allSlides}
    sliderWidth={windowWidth}
    itemWidth={windowWidth}
    renderItem={RenderCarouselItem}
    onSnapToItem={(index) => setActiveSlide(index)}
    inactiveSlideOpacity={1}
    inactiveSlideScale={1}
    decelerationRate={5}
/>

I tried to use decelerationRate without success.

Does anybody got this problem with that lib ?

Thanks

2

There are 2 best solutions below

0
On

I think even though I had the same problem with scroll so I added some props in a carousel which solved my issue I think you have a problem with the declarationRate you should reduce it. `

<Carousel
    ref={carouselRef}
    keyExtractor={carouselKE}
    data={allSlides}
    sliderWidth={windowWidth}
    itemWidth={windowWidth}
    renderItem={RenderCarouselItem}
    onSnapToItem={(index) => setActiveSlide(index)}
    inactiveSlideOpacity={1}
    inactiveSlideScale={1}
    lockScrollWhileSnapping={true}
    enableMomentum={false}
    decelerationRate={0.25}
/>
0
On

https://www.npmjs.com/package/react-native-snap-carousel/v/4.0.0-beta.6

Updated to beta package and fixed the problem. Added disableIntervalMomentum to true

<Carousel
    ...
    disableIntervalMomentum={true}
    ... 
/>