meliorence / meliorence/react-native-snap-carousel
onSnapToItem not called when drag+release in center of item.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
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 - put an x character between the square brackets ([]).)
- I have read the guidelines regarding bug report.
- I have reviewed the documentation in its entirety, including the dedicated documentations 📚.
- I have searched for existing issues and made sure that the problem hasn't already been reported.
- I am using the latest plugin version.
- I am following the issue template closely in order to produce a useful bug report.
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?
Both platforms. Happens on all versions I've tested so far.
Is the bug reproducible in a production environment (not a debug one)?
Yes
Environment
Environment:
React: 16.9.0
React native: 0.61.5
react-native-snap-carousel: 3.8.4
Target Platform:
iOS (13.2.2)
Expected Behavior
Dropping the control in the center of a new item should fire onSnapToItem, as it does when it dropped anywhere else.
Actual Behavior
Dropping the control in the exact center of a new item doesn't fire onSnapToItem. But it does fire when moving away from the item. See the gif below.

Reproducible Demo
https://snack.expo.io/S1rs_rpaB
Steps to Reproduce
(Write your steps so that anyone can reproduce the issue in the Snack demo you provided.)
- Select first item (if not already selected), the item with a
1. - Drag the next item (
2), and move it to the center of the screen, and release it when the black line in the item is perfectly aligned with the black line in the view behind it. - If perfectly aligned, onSnapToItem won't be called and carousel won't move.
- If onSnapToItem is called, repeat the process until 3. is reproduced.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the linked Expo Snack and reproduce the drag-and-release case where item 2 is centered exactly. Trace the carousel's snapping and onSnapToItem behavior from that reproduction. Done means dropping an item in the exact center consistently triggers onSnapToItem and moves the carousel on both iOS and Android.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- frontend, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100