react-native-ezswiper

react-native-ezswiper切换闪烁问题

解决方案:

  • node_modules中react-native-ezswiper/src/EZSwiper.js修改
  • 1、在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 });
      }
  }
发布了16 篇原创文章 · 获赞 14 · 访问量 1785

猜你喜欢

转载自blog.csdn.net/TanHao8/article/details/103838807