解决react-native-ezswiper可能发生的切换闪烁问题

进入 node_modules中react-native-ezswiper/src/EZSwiper.js中修改

在onScroll中添加

if (this.ezswiper.loop) {
     if (Math.abs(offset - ((this.ezswiper.count + 1) * this.ezswiper.side)) < 20.1) {
          offset = this.ezswiper.side
          this.scrollView.scrollTo()		//增加
          this.scrollView.scrollTo({ [this.ezswiper.scrollToDirection]: offset, animated: false });
      } else if (Math.abs(offset) < 20.1) {
          offset = this.ezswiper.side * this.ezswiper.count
          this.scrollView.scrollTo()         //增加
          this.scrollView.scrollTo({ [this.ezswiper.scrollToDirection]: offset, animated: false });
      }
  }

  

猜你喜欢

转载自www.cnblogs.com/bugDevelopment/p/13206112.html