Offset is ignored on first render when currentIndex != 0
deadlinc opened this issue · 2 comments
deadlinc commented
rubycon commented
I also have this issue but on component mount the carousel often end up between two slides.
The only way I can prevent this, is by delaying the index init/update with a setTimeout
of 10ms. That's not very elegant but internally SideSwipe seems to do a similar thing:
https://github.com/kkemple/react-native-sideswipe/blob/master/src/carousel.js#L91
I suspect the issue is coming from the FlatList offset being computed before the slides layout are fully resolved or something like that. Maybe there's a better workaround using onLayout
.
kaplantm commented
I'm also having this issue, and haven't had luck avoiding it with a setTimeout