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

Swiper rendering last item first

Open romit07 opened this issue 7 years ago • 8 comments

OS : Android and iOS

Version

Which versions are you using:

  • react-native-swiper v : 1.5.14
  • react-native v : 0.57.5

Expected behaviour

Swiper should show first item from the array

Actual behaviour

The active dot is at the first position but the image shown is from the last item of the array. On next swipe the first image gets rendered and active dot remains at the first position. On further swiping it works correct

Steps to reproduce: Set the height of the Swiper container, when height is not given in style, it works correct but takes a random height

romit07 avatar Feb 07 '19 06:02 romit07

Hello, can you solve it?

zyyace avatar Feb 18 '19 06:02 zyyace

same issue in IOS.

zhpoo avatar Feb 22 '19 05:02 zhpoo

same here, when the loop={true}

JinHoSo avatar Feb 22 '19 06:02 JinHoSo

same issue in Android

relign avatar Mar 11 '19 11:03 relign

I guess it show because of that ViewPagerAndroid setPage is asynchronous

relign avatar Mar 11 '19 11:03 relign

I solved the issue isolating the Swiper in a class component and sending my information via props and applied a shouldComponentUpdate with this condition:

shouldComponentUpdate = nextProps => {
    return btoa(nextProps) !== btoa(this.props)
}

ps.: If the props are too long it will always return true, so I converted it to base64 to compare the returned strings.

intransitorio avatar Jun 06 '19 15:06 intransitorio

Any easy fix on this ?

Foskas avatar Sep 12 '19 18:09 Foskas

I find this repo https://github.com/f111fei/react-native-banner-carousel works which save my life

KNighD avatar Oct 27 '20 08:10 KNighD