leecade / leecade/react-native-swiper

onMomentumScrollEnd & onTouchStartCapture: wrong index

Open
#1,136 5 comments 0 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

Which OS ?

MacOS: both iOS and Android simulator

Version

Which versions are you using:

  • react-native-swiper v?
    react-native-swiper@v1.6.0-rc.3

  • react-native v0.?.?
    "0.61.5"

Expected behaviour

Valid indexes on swipe forward and back. Actual log using v1.6.0-rc.2 which doesn't have an issue:

LOG index: 1 << yes, 1, as 0 is just dismissed
LOG index: 2
LOG index: 3 << just swiped to the last slide
LOG index: 2 << going back
LOG index: 1
LOG index: 0 << to the beginning

onTouchStartCapture has the same issue.

Actual behaviour

LOG index: 0 << it is an index of second view, expected "1"
LOG index: 1
LOG index: 2 << just swiped to the last slide
LOG index: 3 << I swiped back, but index is increased
LOG index: 2
LOG index: 1 << I'm on the first slide

How to reproduce it>

examples/components/Swiper/index.js with loop={false} doesn't work.
I couldn't build and run examples in forked project, too many errors (gyp, not found simulator, etc). So, I gave up fixing them and google solutions, and I just copied and pasted it to my own project.

Steps to reproduce
  1. run the example examples/components/Swiper/index.js with loop={false}
  2. swipe to the end and check log along the way
  3. swipe to the beginning and check log along the way

Contributor guide

No contributing guide indexed for this repository

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 with examples/components/Swiper/index.js and reproduce the loop={false} case while logging onMomentumScrollEnd and onTouchStartCapture during forward and backward swipes. Compare the callback indexes in react-native-swiper v1.6.0-rc.2 and v1.6.0-rc.3; done means the callbacks report the visible slide indexes from the first slide through the last and back.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.