meliorence / meliorence/react-native-snap-carousel

onSnapToItem not called when drag+release in center of item.

Open
#635 5 comments 7 reactions 0 assignees View on GitHub

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 ([]).)

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.

rnsc-dragging-issue

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.)

  1. Select first item (if not already selected), the item with a 1.
  2. 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.
  3. If perfectly aligned, onSnapToItem won't be called and carousel won't move.
  4. If onSnapToItem is called, repeat the process until 3. is reproduced.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.