Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onIndexChanged throwing bug into UI #1344

Closed
maxmandia opened this issue Jul 30, 2022 · 5 comments
Closed

onIndexChanged throwing bug into UI #1344

maxmandia opened this issue Jul 30, 2022 · 5 comments

Comments

@maxmandia
Copy link

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
Copy link
Author

If set prop loadMinimal is true it works

@KonstantinKostianytsia
Copy link

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

@LucasHimelfarb
Copy link

LucasHimelfarb commented Jun 27, 2023

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

@Ankush-Hegde
Copy link

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

@Ankush-Hegde
Copy link

@maxmandia did u get the solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants