react-native-swiper icon indicating copy to clipboard operation
react-native-swiper copied to clipboard

Swiper resets offset to 0 after rendering

Open michel-p opened this issue 9 years ago • 0 comments

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.

bug-swiper 22 28 32

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

1. 2. 3.

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

michel-p avatar Nov 22 '17 10:11 michel-p