Bug Report
yes
yes
I think so
Have not tested on Android.
Yes, have this app in testflight (release mode) and this behavior exists.
(Write your answer here.)
(Write your answer here.)
(Write your steps here:)
No matter how many slides I have, if activeSlideAlignment is 'center', I expect the slide to be centered in the view (so that the previous and next slides can be seen).
*** This should give you what you need
Here is a video of the project I am working on and the bug in action:
https://www.youtube.com/watch?v=DMq1Q1-RWus&feature=youtu.be
Here is a snack. Read comments at top
https://snack.expo.io/@akyker20/react-native-snap-carousel-bug
Lastly, just wanna say thanks. I really like this project. You guys are awesome!
(Paste the link to an example project or paste the entirety of the relevant source code. Then provide instructions to reproduce the issue.)
Hi @akyker20,
Thank you for taking the time to put up a top quality bug report!
Regarding the issue, this is indeed pretty strange. I fear an internal FlatList bug, but I'll dig around to find out what's really at stake. I'll probably be able to keep you posted next week.
By the way, congratulations for your app; it looks awesome ;-)
Hi @akyker20,
Can you tell me if you're still able to reproduce the issue when using the latest commit from branch v3.5.0 and setting the new prop useScrollView to true? I'm trying to determine if this is a FlatList-specific bug...
If needed, you can take a look at this note about using a commit not already published on npm.
I've just had an idea and tried overriding the default initialNumToRender by setting it to 30. Result: it works! This means that the issue is, as I feared, a FlatList one and that I have no control over this behavior. It seems like the FlatList component is not able to properly keep track of the items that are not in the currently rendered batch...
Those are the options I see at this point:
useScrollView to true. Note that you will loose all FlatList optimizations by doing that and keep in mind that it's not a viable solution if you have a huge dataset to display.FlatList component instead of the Carousel one (you can reuse props data and renderItem). Do you still experience the issue? If the answer is no, please let me know because this might indicate that some FlatList defaults are better left unchanged...FlatList props until you find something that suits your needs: initialNumToRender, maxToRenderPerBatch, windowSize and updateCellsBatchingPeriod.
Most helpful comment
I've just had an idea and tried overriding the default
initialNumToRenderby setting it to30. Result: it works! This means that the issue is, as I feared, aFlatListone and that I have no control over this behavior. It seems like theFlatListcomponent is not able to properly keep track of the items that are not in the currently rendered batch...Those are the options I see at this point:
useScrollViewtotrue. Note that you will loose allFlatListoptimizations by doing that and keep in mind that it's not a viable solution if you have a huge dataset to display.FlatListcomponent instead of theCarouselone (you can reuse propsdataandrenderItem). Do you still experience the issue? If the answer is no, please let me know because this might indicate that someFlatListdefaults are better left unchanged...FlatListprops until you find something that suits your needs:initialNumToRender,maxToRenderPerBatch,windowSizeandupdateCellsBatchingPeriod.