leecade / leecade/react-native-swiper
iOS stuck when quick scrolling with loop enabled
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
The issue is only for iOS, Android works fine.
I was able to reproduce it both on real device and in simulator.
I have Swiper with four slides and loop option set to true. When I swipe to one direction very fast, pretty soon the whole slider is stuck and I am no longer able to swipe to that same direction. I can swipe in the opposite direction though, if I do it once (swipe back one slide), then it "unstucks" and I can swipe in the original direction again.
From my research it stops on the last slide if I quickly swipe to the left, or on the first slide if I quickly swipe to the right.
The problem is that onMomentumScrollEnd is only fired when the animation ends, but when I swipe quickly (I start new swipe action in the middle of previous animation) animation never ends and callback never fires. It leads to the situation when offset keep growing, a queue of looped slides is never updated and I am able to get to the "end" of the slides even though it is a looped mode. I guess that's why it only stops on the first or the last slide.
Maybe it is possible to somehow update the state mid-air without waiting for animation to end and without actually interrupting active animation with any visible lags?
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
Reproduce the rapid same-direction swipe on iOS in both a simulator and a real device, using four slides with loop enabled. Start by tracing the onMomentumScrollEnd callback and the looped-slide update behavior; done means quick repeated swipes do not leave the slider stuck at the first or last slide.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100