leecade / leecade/react-native-swiper
Swiper resets offset to 0 after rendering
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 9.0
Version
Which versions are you using:
react-native-swiper v1.5.13
react-native v0.49.3
Expected behaviour
When swiping quickly to slide n°2 after rendering, Swiper should not reset offset to slide N°1.
Actual behaviour
On IOS 9.0, when swiping quickly to slide n°2 after rendering, the offset of the swiper is reset to 0. the result is that you see the content of slide n°1, but have the pagination set on slide n°2.

How to reproduce it>
With the Swiper example
Important : I have an API call to retrieve some data before rendering the swiper, all the data retrieved is passed to the Swiper parent component, then some child component inside the swiper are rendered but for simplicity I removed them and put those colored screens to demonstrate. The described bug is hard to reproduce when you don't load any data because you have to be super quick to swipe to slide N°2.
Steps to reproduce
What fixed the bug for me
I removed the special IOS contentOffset step on the onLayout function :
https://github.com/michel-p/react-native-swiper/commit/b5232fbed320387e8e75dc8f3a50d2df834d5739
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 with the Swiper example and trace the onLayout handler, especially its iOS contentOffset handling. Reproduce the issue by loading data before rendering and swiping quickly to slide 2 on iOS 9. Done means the visible slide and pagination remain on slide 2 after rendering; compare the reporter's linked commit for context.
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