leecade / leecade/react-native-swiper

Swiping back/forth eventually causes this.internals.isScrolling to stay true in onScrollEndDrag

Open
#888 2 comments 1 reaction 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 ?

iOS

Version

Which versions are you using:

  • react-native-swiper v1.5.13
Expected behaviour

Swiping left and right moves around screens.
Clicking our "Next" button also advances screens

Actual behaviour

Sometimes doing the above renders the "Next" button useless.
(because: this.internal.isScrolling stays true)

Steps to reproduce
  1. Go to screen 2, for example (just not the first or last screen)
  2. Swipe left/right or right/left by keeping finger on screen
  3. Will eventually encounter case when previousOffset and newOffset are equal
  4. Pressing the "Next" button does not advance to the next screen. (our Next button calls scrollBy(1))
How we solved the problem:

in onScrollEndDrag (in your library):
code that caused bug:
if (previousOffset === newOffset && (index === 0 || index === children.length - 1)) { this.internals.isScrolling = false }

our fix:
if (previousOffset === newOffset) { this.internals.isScrolling = false }

Will this fix have other side effects in your library? We've tested the functionality that we need on our side and everything still works.
Is (index === 0 || index === children.length - 1) a performance optimization to not animate/scroll?

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 at the library's onScrollEndDrag handler and trace how previousOffset, newOffset, index, and internals.isScrolling interact with scrollBy(1). Reproduce the issue by swiping between middle screens until the offsets are equal, then verify that the Next button advances again. Done means isScrolling resets for equal offsets without breaking boundary behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.