Closed dallen4 closed 6 years ago
Hey @dallen4! Thanks for reporting this. Are you using horizontal or vertical paging?
@zachgibson horizontal!
Hmm, let me run the component on that device and see if I can reproduce the bug.
@zachgibson let me know if you have any luck
@dallen4 Just tested on Google Pixel 7.1.0 API 25 and indices are logging as expected. I’m testing using the example in this repo’s readme. Can you post your code?
@zachgibson Thank you for the quick response to the issue. As @dallen4 pointed out, the issue seems to be device-specific. I also tested the example posted on the ReadMe on an android device with the following specs:
I believe @dallen4 meant say that it worked just fine on other android devices, such as the Google Pixel device you tested, but fails on the aforementioned device specs. Even running the following code snippet:
<ParallaxSwiper
parallaxStrength={100}
dividerWidth={0}
dividerColor="transparent"
children={this.props.children}
onMomentumScrollEnd={activePageIndex => console.log(activePageIndex)}/>
When I tested this, I received indices 0, 0, 1 on a list of 3 screens views.
@Jmeza081 thanks for posting that snippet! Your dividerWidth={0}
led me to the bug. I was incorrectly rounding the value and this happened to work unless you set dividerWidth to 0.
I’m patching this and I’ll publish to npm shortly.
Fixed in 0.5.4 👍
When testing the ParallaxSwiper on the Google Nexus 5X Android device, I found that I can't get the correct activePageIndex using the onMomentumScrollEnd prop. When using it as the example shows:
onMomentumScrollEnd={activePageIndex => console.log(activePageIndex)}
It prints the incorrect indexes. For example, on a four page swiper, it returns 0, 0, 1, 3, respectively for the pages. This has been tested on both API 23 and API 25, ruling out the issue of API versions. It was also tested on a Google Pixel running API 25. It seems to work just fine for iOS devices.