React native snap carousel在幻灯片之间没有暂停



不好意思,我不知道怎么解释。因此,我在我的EXPO应用程序上使用React-native-snap-carousel(3.9.1)来添加一个简单的carousel。

当我在幻灯片之间滑动时,没有等待/暂停。通过快速滑动,我可以直接转到最后一张幻灯片。但是我想在滑动和再次滑动之间休息一下,以便转到下一张幻灯片。

这个问题只出现在我的设备上:荣耀20/Android 10我使用其他设备,如S10或IOS设备没有任何问题。

这是我的carousel代码:

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

我尝试使用decelerationRate没有成功。

有人遇到这个问题吗?

感谢

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

更新到beta包并修复了问题。添加disableIntervalMomentum为true

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

我认为即使我有滚动相同的问题,所以我在旋转木马中添加了一些道具,这解决了我的问题,我认为你有一个问题与声明率,你应该减少它。'

<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}
/>

最新更新