-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onSnapToItem & onBeforeSnapToItem do not fire reliably on left / right edges on Android #425
Comments
Hey @jkdf2, Have you tried to get rid of |
Hi @bd-arc, Great suggestion. Unfortunately, removing the Here is a Snack that shows the issue remains. |
It would appear that the issue is rooted in |
@jkdf2 Thanks for the heads up! I'll look into it as soon as possible. |
@bd-arc Is there a workaround for the meanwhile? |
I am also facing the same problem. |
Hi guys, Does PR #443 solve the bug for you? |
@bd-arc No change. Are you sure you tagged the right PR? I'm not seeing how that PR relates to this issue. |
@bd-arc I have the same problem. Really blocking thingy and I can't find a proper Swiper that works with many items like this awesome component.
When using onViewableItemsChanged instead sometimes the "ViewableItems" become 2 instead of 3. Do you have any info if this is going to be resolved because I might need to find some other component? |
Hi @jkdf2 |
I also have the same issue? Did any one have workaround for this? |
I ran into this issue as well. Spent a few minutes logging various things inside the package and here's what i found (in case someone finds it useful). The reason this is not an issue on iOS (or when When I added a very quick and hacky fix to my project by manually calling snapTo depending on the ScrollViews scroll offset. I am also attaching a patch-file for the latest library version in case this helps someone. In both the screenshot and the patch file, the "fix" is for vertical carousels only and may cause performance issues; however, it's been working out so far. |
@yulolimum Thanks a lot for the valuable information! I'll see what I can do with it in order to implement a built-in fix ;-) |
Any progress on this? I'm experiencing the same issue. Yuolimum's fix helps, but it's still not super reliable. EDIT: For the folks that are experiencing this issue, a possible workaround is to set swipeThreshold to 0. I tried it just now, and my carousel seems to be behaving much better now. |
@bd-arc any progress on that fix? |
@austinthetaco Unfortunately no. I haven't been able to work on the plugin recently due to work overload. If someone wants to jump in, now's the chance! |
I was also facing the similar issue with horizontal carousel. I needed the equal spacing from left , right of the first cards as well as tin between the cards. In between the card spacing was achieved as mentioned in the document, and for aligning the leftmost and right most card spacing from screen was done by setting the contentContainerCustomStyle and setting these values, which ultimately lead to changing the carousel logic , therefore snapToIndex was not triggering. So i ended up adding onBeforeSnapToIndex along with it as well as enableMomentum true. This is how it worked for me.
Hope this will help someone. |
Is this a bug report, a feature request, or a question?
Bug report
Have you followed the required steps before opening a bug report?
(Check the step you've followed - replace the space character between the square brackets (
[]
) by anx
.)Have you made sure that it wasn't a React Native bug?
Yes.
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
Android only, I believe
Is the bug reproductible in a production environment (not a debug one)?
Yes.
Environment
Env:
React: 16.6.0-alpha.8af6728
react-native: 0.57.4
react-native-snap-carousel: 3.7.5
Target platform:
Expected Behavior
Expected
onSnapToItem
to be fired reliably for every index.Actual Behavior
onSnapToItem
does not fire if scrolling all the way to the left or right edges.gfycat video (look at the bottom for the Active index display)
Reproducible Demo
https://snack.expo.io/SJ6vPURhm
Steps to Reproduce
From the example, scroll to a middle slide on Android.
Scroll all the way to the left or right and release.
The state
index
is not updated.The text was updated successfully, but these errors were encountered: