Retrieving current index without waiting end of slide

When I try to retrieve the current index of the carousel item, there is a one second delay. How can I retrieve the index of the current object without waiting for the end of the slide movement.
I was using momentum but now it is deprecated.

I use this
onSnapToItem={index => this.setState({ activeIndexCarousel: index })} />

Thank you for the help!

1 possible answer(s) on “Retrieving current index without waiting end of slide

  1. @oliverdolgener thanks for your help but onBeforeSnapItem has been deleted on version 4. For the onScroll event script you wrote, carousel is broke when using it. The others items still blur and in small size when scrolling.

    Found a solution with onScrollIndexChanged I missed this one.

Retrieving current index without waiting end of slide

When I try to retrieve the current index of the carousel item, there is a one second delay. How can I retrieve the index of the current object without waiting for the end of the slide movement.
I was using momentum but now it is deprecated.

I use this
onSnapToItem={index => this.setState({ activeIndexCarousel: index })} />

Thank you for the help!

1 possible answer(s) on “Retrieving current index without waiting end of slide

  1. @oliverdolgener thanks for your help but onBeforeSnapItem has been deleted on version 4. For the onScroll event script you wrote, carousel is broke when using it. The others items still blur and in small size when scrolling.

    Found a solution with onScrollIndexChanged I missed this one.