react-native-swiper icon indicating copy to clipboard operation
react-native-swiper copied to clipboard

onIndexChanged throwing bug into UI

Open maxmandia opened this issue 2 years ago • 1 comments

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 => {.......

maxmandia avatar Jul 30 '22 19:07 maxmandia

If set prop loadMinimal is true it works

maxmandia avatar Jul 30 '22 20:07 maxmandia

I discovered that it reproduces only if you set the state in the function with console.log it works fine

KonstantinKostianytsia avatar Mar 02 '23 18:03 KonstantinKostianytsia

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()}
            >

LucasHimelfarb avatar Jun 27 '23 15:06 LucasHimelfarb

#1333 index value will be out of reange after updating the UseState

Ankush-Hegde avatar Feb 08 '24 06:02 Ankush-Hegde

@maxmandia did u get the solution?

Ankush-Hegde avatar Feb 09 '24 05:02 Ankush-Hegde