Swiper rendering last item first
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
Hello, can you solve it?
same issue in IOS.
same here, when the loop={true}
same issue in Android
I guess it show because of that ViewPagerAndroid setPage is asynchronous
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.
Any easy fix on this ?
I find this repo https://github.com/f111fei/react-native-banner-carousel works which save my life