React-native-swiper: react-native 0.48.3 and react-native-swiper - Last slide shown first

Created on 15 Sep 2017  路  7Comments  路  Source: leecade/react-native-swiper

Which OS ?

IOS

Version

Which versions are you using:

  • react-native-swiper v1.5.12 (but it affect every single version of it, tried back to 1.5.4 as well)
  • react-native v0.48.3

Expected behaviour

  • The first slide should be first.

Actual behaviour

  • The last slide showed first.
  • Awkward pagination display - it shows the state of the first slide, while displaying the last slide.

p.s. If loop={false} is set - everything seems fine.

How to reproduce it>

Just get the repo from
https://github.com/nixoz/swiperDemo
-

Steps to reproduce

  1. Create mint react-native project
  2. Copy paste first example from react-native-swiper README
  3. react-native run-ios
  4. KABOOM!

Most helpful comment

Have you try with loop=false ?

All 7 comments

UPD: I guess it related to regression 'ScrollView contentOffset bug' -
https://github.com/facebook/react-native/issues/15808

UPD: Yup, it is.

Yes it's a regression, not working also on RN 0.46

not working also on RN 0.44

Have you try with loop=false ?

same issue here

The bug is here
if (loop) {
pages.unshift(total - 1 + '')
pages.push('0')
}

pages is modified but index is not updated. So the "current" page change.

Still exists in iOS whatever version.
Can you tell me what is the action in this step to update in Line 329?
https://github.com/leecade/react-native-swiper/blob/f00abfb859ce384be2003cfce3010c3fc0005be1/src/index.js#L324-L330

When I change the code,It works as well as Android

- this.setState(state)
+ Platform.OS !== 'ios'&&this.setState(state)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

nomoreboredom picture nomoreboredom  路  3Comments

AndrewSouthpaw picture AndrewSouthpaw  路  3Comments

JonasOmdal picture JonasOmdal  路  3Comments

commit-master picture commit-master  路  3Comments