I have a react native swiper component that auto scrolls when I swipe, which results in two images showing together, but it doesn’t do this if I remove onindexchanged()
the issue
what I want when I swipe
The code
<Swiper
index={0}
loop={false}
autoplay={false}
onIndexChanged={(index) => {
setCurrentIndex(index)
}}
showsPagination={false}
loadMinimal
loadMinimalSize={1}
horizontal={false}
>
{[{ id: "cover", image: image }, ...images]
.filter((item) => item.image)
.map((item, index) => (
<Manga
key={item.id}
coverImage={item.image}
img={item.image}
index={index}
blurStatus={blurStatus}
overlayVisible={overlayVisible}
commentsForImages={commentsForImages}
refRBSheet={refRBSheet}
/>
))}
</Swiper>
this causes the issue
onIndexChanged={(index) => {
setCurrentIndex(index);
}}
this doesn’t
onIndexChanged={(index) => {
console.log(index)
}}