Jia*_*jun 3 performance scrollview react-native
现在我用interval来实现,但是很不连贯。如果我能改变方法 ( scroll) 的速度,那就太好了。
this.interval = setInterval(()=>{
if(!_scroll){
_this.interval && clearInterval(_this.interval);
}
if(totalWide+ScreenWidth >= width ){
_scroll.scrollWithoutAnimationTo();
totalWide=0;
i=0;
}else{
_scroll.scrollTo({x:eachWide*i,animate:true});
totalWide = totalWide + eachWide;
i= i+1;
}
},250)
Run Code Online (Sandbox Code Playgroud)
小智 8
使用ScrollView 的decelerationRate属性
<ScrollView decelerationRate={0.5}>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7790 次 |
| 最近记录: |