meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.37k stars 2.29k forks source link

Freeze after sliding to the second item #867

Closed Drckk closed 3 years ago

Drckk commented 3 years ago

This happens when autoplay and vertical are set, and itemHeight is less than 40.

Using activeSlideOffset props can solve my problem (default value is 20)

<Carousel
  activeSlideOffset={height / 2 - 2}  // add this
  scrollEnabled={false}
  style={{flex: 1}}
  data={data}
  renderItem={renderItem}
  autoplay
  loop
  vertical
  itemWidth={width}
  itemHeight={height}
  sliderWidth={width}
  sliderHeight={height}
  autoplayDelay={500}
  autoplayInterval={3000}
  removeClippedSubviews={false}
/>

May not be the best way, but it did solve my problem. Hope to help someone in need.😃

"react-native": "0.62.3", "react-native-snap-carousel": "^3.9.1",