You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thank you for the amazing work on this library!
I have a question about event handling for snapping behavior in the carousel. In libraries like react-native-snap-carousel, there is a prop called onBeforeSnapToItem, which provides the index of the page we are about to snap to before the snap animation is complete.
I noticed that this library has the onSnapToItem prop, but it triggers only after the snap is fully completed.
Is there any existing functionality or workaround in the library that allows me to detect the target index before the snapping animation completes? This would help in scenarios where I need to trigger updates or preload data while the user is swiping, but before the snap is finalized.
If this feature doesn’t exist yet, are there plans to implement something similar, or is there a recommended way to achieve this behavior?
Thank you for your time and help!
The text was updated successfully, but these errors were encountered:
Hey @zaidqureshi95! I'm here to help you with any questions or issues you have. Let's work together to tackle this challenge!
A similar open issue discusses achieving functionality similar to onBeforeSnapToItem. The suggested solution involves using the customAnimation prop to predict the index during the animation. This method allows you to run a function when the animation value exceeds a certain threshold, updating a variable to ensure it only runs once. This way, you can predict the index while the animation is running, without waiting for the onSnapToItem prop to provide an index. However, it's important to validate the predicted index with the actual index to avoid discrepancies in future index changes. You can find more details in the issue discussion[1].
Hello,
First, thank you for the amazing work on this library!
I have a question about event handling for snapping behavior in the carousel. In libraries like
react-native-snap-carousel
, there is a prop calledonBeforeSnapToItem
, which provides the index of the page we are about to snap to before the snap animation is complete.I noticed that this library has the
onSnapToItem
prop, but it triggers only after the snap is fully completed.Is there any existing functionality or workaround in the library that allows me to detect the target index before the snapping animation completes? This would help in scenarios where I need to trigger updates or preload data while the user is swiping, but before the snap is finalized.
If this feature doesn’t exist yet, are there plans to implement something similar, or is there a recommended way to achieve this behavior?
Thank you for your time and help!
The text was updated successfully, but these errors were encountered: