react-native-swiper
react-native-swiper copied to clipboard
onIndexChanged throwing bug into UI
Which OS ?
MacOS
Version
Which versions are you using:
"react-native-swiper": "^1.6.0",
"react-native": "0.69.1",
Expected behaviour
I want to normally swipe through all of my items I am mapping over
Actual behaviour
Every time I swipe through an item, it send me back to the item I was just on, and when I swipe again, I am then brought to the correct item. This repeats for every new item I see in the UI
Steps to reproduce
<Swiper horizontal={true} showsButtons={false} index={0} onIndexChanged={index => setSongIndex(index)} style={styles.swiper} showsPagination={false}> {feed.map(post => {.......
If set prop loadMinimal is true it works
I discovered that it reproduces only if you set the state in the function with console.log
it works fine
you don't use "index" prop, that's work wrong with the "onIndexChanged" prop. My configuration:
<Swiper
loop={false}
ref={swiperRef}
loadMinimal={true}
dotColor={Colors.gray}
showsPagination={false}
onIndexChanged={onIndexChanged}
activeDotColor={Colors.cerisePink}
scrollEnabled={validateScrollEnabled()}
>
#1333 index value will be out of reange after updating the UseState
@maxmandia did u get the solution?