leecade / leecade/react-native-swiper
Swiping back/forth eventually causes this.internals.isScrolling to stay true in onScrollEndDrag
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
- Go to screen 2, for example (just not the first or last screen)
- Swipe left/right or right/left by keeping finger on screen
- Will eventually encounter case when previousOffset and newOffset are equal
- 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
- 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 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