我想在本机反应中更改滚动视图滚动速度

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)