React-native-snap-carousel: I want to know the active item's index

Created on 19 Jun 2019  路  2Comments  路  Source: meliorence/react-native-snap-carousel

I want to know the current active item index after a scroll or after a snap. I see that onSnapToItem(index) gets called only when carousel.snapToItem(index) is done but not during scrolling ends. So which callback should I use?

Most helpful comment

Hi folks, Seems like a cosmetic bug.
Setting activeSlideOffset={2} solved my issue. Now onSnapToItem(index) gets called while scrolling as well as snapping. :)

All 2 comments

Hi folks, Seems like a cosmetic bug.
Setting activeSlideOffset={2} solved my issue. Now onSnapToItem(index) gets called while scrolling as well as snapping. :)

carouselRef.current.currentIndex is a manual way to get the current index

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dr1992 picture Dr1992  路  4Comments

NikitaNeganov picture NikitaNeganov  路  3Comments

Murena7 picture Murena7  路  3Comments

siderakis picture siderakis  路  3Comments

AndrePech picture AndrePech  路  4Comments