sp; onMomentumScrollEnd={(e)=>{this._onAnimationEnd(e)}}
//开始拖拽
onScrollBeginDrag={()=>{this._onScrollBeginDrag()}}
//结束拖拽
onScrollEndDrag={()=>{this._onScrollEndDrag()}}
>
{this._renderAllImage()}
</ScrollView>
<View style={styles.pageViewStyle}>
{this._renderAllIndicator()}
</View>
</View>
);
}
/**开始拖拽 */
_onScrollBeginDrag(){
console.log("开始拖拽");
//两种清除方式 都是可以的没有区别
// this.timer && clearInterval(this.timer);
this.timer && clearTimeout(this.timer);
}
/**停止拖拽 */
_onScrollEndDrag(){
console.log("停止拖拽");
this.timer &&this._startTimer();
}
/**1.轮播图片展示 */
_renderAllImage() {
let allImage = [];
let imgsArr = ImageData.data;
for (let i = 0; i < imgsArr.length; i++) {
let imgsItem = imgsArr[i];
allImage.push(
<Image key={i} source={{uri:imgsItem.icon}} style={styles.imageStyle} />
);
}
return allImage;
}
/**2.手动滑动分页实现 */
_onAnimationEnd(e) {
//求出偏移量
let offsetX = e.nativeEvent.contentOffset.x; &nbs |