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.25k stars 2.26k forks source link

After one full cycle, the next slide shows with opposite direction #904

Open hubertstruminski opened 2 years ago

hubertstruminski commented 2 years ago

Hello,

I have implemented Carousel autoplay. After one full cycle (when every element in the array has been showed) the next slide starts animation from left to right instead of right to left. It looks like opposite direction, but only for one item.

Here is my code:

const carousel = [ { image: require('../../../../assets/icons/startScreen/Onboarding_01.gif'), id: 0, text:${strings.slider.item1} }, { image: require('../../../../assets/icons/startScreen/Onboarding_02.gif'), id: 1, text:${strings.slider.item2} }, { image: require('../../../../assets/icons/startScreen/Onboarding_03.gif'), id: 2, text:${strings.slider.item3} }, { image: require('../../../../assets/icons/startScreen/Onboarding_04.gif'), id: 3, text:${strings.slider.item4} }, ];

<Carousel ref={(e) => (sliderRef.current = e)} layout="default" data={carousel} sliderWidth={Dimensions.get('window').width} itemWidth={Dimensions.get('window').width} renderItem={renderItem} autoplay autoplayInterval={3000} loop />

const renderItem = ({ item }) => { return ( <ImageItem image={item.image} key={item.id} text={item.text} /> ); };

ImageItem component:

`const ImageItem = ({ image, text }) => { return (

{text}

); };`

Does anyone know what can be cause this issue ?

redvelvet-fan commented 2 years ago

same issue

Manju-lab commented 2 years ago

same issue

sxyshirly commented 2 years ago

same issue any solutions?