leecade / leecade/react-native-swiper

scrollBy set negative index when swipper has an hidden display

Open
#889 0 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 ?

react-native info

React Native Environment Info:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 6.75 GB / 15.86 GB
Binaries:
Yarn: 1.5.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.2.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5014246

Version

Which versions are you using:

  • react-native-swiper 1.5.13
  • react-native 0.57.1
Expected behaviour

When using a ref to call scrollBy function on a swipper component which is hidden (ie zindex)
change the page and keep index equal to 0 or higher (corresponding to the good index)

Actual behaviour

When using a ref to call scrollBy function on a swipper component which is hidden (ie zindex)
index is equal to -1

Workaround>

in file react-native-swiper\src\index.js
add an "else statement" at line 422 in function updateIndex
else {
index = Math.max(0, index)
}

This solution don't work if swipper is in loop mode true.

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 in src/index.js, at the updateIndex function around the reported line 422, and reproduce scrollBy on a hidden swiper. Check both normal mode and loop mode, using the reported React Native versions if possible. Done means the resulting index is never negative and remains the correct page in both modes.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.