leecade / react-native-swiper

The best Swiper component for React Native.
MIT License
10.37k stars 2.35k forks source link

Swiper changes index unwantedly on Redux update #1177

Open initzx opened 4 years ago

initzx commented 4 years ago

Which OS ?

IOS 12

Version

Which versions are you using:

Problem

When redux updates the swiper's elements asynchronously, the swiper's index is changed to the index of the element before the current element when it should have just stayed the same. This issue does not seem to affect my Android phone.

koolll commented 4 years ago

Which OS ?

IOS 12

Version

Which versions are you using:

  • react-native-swiper v^1.6.0-nightly.5
  • react-native 0.61.4

Problem

When redux updates the swiper's elements asynchronously, the swiper's index is changed to the index of the element before the current element when it should have just stayed the same. This issue does not seem to affect my Android phone.

Hi, FYI this issue solve after i add loop={false} <Swiper loop={false} ref={this.mySwipeRef} index={this.state.swipeIndex} style={this.styles.wrapper} showsButtons={false} showsPagination={false} onIndexChanged={(index) => this.onSwipeIndexChanged(index)}

jonathanmachado commented 4 years ago

same here only android

cuddeford commented 4 years ago

This is happening for me too but is caused by any prop change. Setting loop to false does indeed fix it but now that feature is lost.

wangqiannan commented 2 years ago

add loadMinimal={true} may helps you, see this