Open YangBo29 opened 2 years ago
adaptiveHeight 这个属性的计算上有问题,导致了这个bug,应该是每次重新计算高度导致动画和动画间隔的监听出现了错乱
componentDidUpdate = prevProps => { this.checkImagesLoad(); this.props.onReInit && this.props.onReInit(); if (this.props.lazyLoad) { let slidesToLoad = getOnDemandLazySlides({ ...this.props, ...this.state }); if (slidesToLoad.length > 0) { this.setState(prevState => ({ lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad) })); if (this.props.onLazyLoad) { this.props.onLazyLoad(slidesToLoad); } } } // if (this.props.onLazyLoad) { // this.props.onLazyLoad([leftMostSlide]) // } this.adaptHeight(); let spec = { listRef: this.list, trackRef: this.track, ...this.props, ...this.state }; const setTrackStyle = this.didPropsChange(prevProps); setTrackStyle && this.updateState(spec, setTrackStyle, () => { if ( this.state.currentSlide >= React.Children.count(this.props.children) ) { this.changeSlide({ message: "index", index: React.Children.count(this.props.children) - this.props.slidesToShow, currentSlide: this.state.currentSlide }); } if (this.props.autoplay) { this.autoPlay("update"); } else { this.pause("paused"); } }); };
this.adaptHeight(); 这个函数的执行重新计算了高度,也引起了这个问题。可能需要重新考虑一下自动更新高度的方式