Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native React Native ScrollView scrollToEnd({duration:5000})不工作-Android_React Native_React Native Android_React Native Scrollview - Fatal编程技术网

React native React Native ScrollView scrollToEnd({duration:5000})不工作-Android

React native React Native ScrollView scrollToEnd({duration:5000})不工作-Android,react-native,react-native-android,react-native-scrollview,React Native,React Native Android,React Native Scrollview,我正在尝试制作一个ScrollView,它将在一段时间内自动滚动到底部。但相反,它会立即滚动到底部 moveScreen = () =>{ this.scrollViewRef.flashScrollIndicators(); this.scrollViewRef.scrollToEnd({duration: 5000, animated: true});} setScrollViewRef = (element) => { this.scrollViewRef = element

我正在尝试制作一个ScrollView,它将在一段时间内自动滚动到底部。但相反,它会立即滚动到底部

moveScreen = () =>{
this.scrollViewRef.flashScrollIndicators();
this.scrollViewRef.scrollToEnd({duration: 5000, animated: true});}

setScrollViewRef = (element) => {
this.scrollViewRef = element;};

render(){
return (
  <View style={{height:'100%', width:'100%',flexDirection:'row'}}>
    <ScrollView ref={this.setScrollViewRef} style={{height:'100%',width:'90%'}} onContentSizeChange={()=> this.moveScreen()}>
      {balloonList}
    </ScrollView>
    <View style={{height:'100%',width:'10%',justifyContent:'flex-end',}}>{bucketList}</View>
  </View>
);}

与其试着用你想要的持续时间设置超时,我已经做到了

setTimeout(() => this.scrollViewRef.scrollToEnd({duration: 500, animated: true}) , 1000);

这里是我的时间,你可以随时提供。希望它是清楚的,否则请询问任何疑问。

与其尝试使用设置超时,还不如使用您想要的持续时间,我已经做到了这一点

setTimeout(() => this.scrollViewRef.scrollToEnd({duration: 500, animated: true}) , 1000);

这里是我的时间,你可以随时提供。希望清楚,否则请询问任何疑问。

如果您在iOS设备上测试此实现的功能,则无法添加持续时间选项,并且无论传递了什么值,它都将立即滚动到末尾

对于Android,您可以为受控的持续时间滚动指定持续时间,例如scrollToEnd{duration:500}

有关更多信息,请参阅文档:

编辑:

事实证明,该功能实际上已经准备好发布,但最终破坏了一些内部调用站点,并最终被还原,但文档仍然提到了它


如果您在iOS设备上测试此实现的功能,则无法添加持续时间选项,并且无论传递了什么值,它都将立即滚动到末尾

对于Android,您可以为受控的持续时间滚动指定持续时间,例如scrollToEnd{duration:500}

有关更多信息,请参阅文档:

编辑:

事实证明,该功能实际上已经准备好发布,但最终破坏了一些内部调用站点,并最终被还原,但文档仍然提到了它


由于超时,它将在1秒后滚动到结束,但在此之后,它将立即向下滚动。我希望滚动到底总共需要5秒。你能试试5000秒吗。500相当于不到1秒。把500换成5000。我这样做了,但它不起作用。我也编辑了这个问题。由于超时,它会在1秒后滚动到结束,但在那之后它会立即向下滚动。我希望滚动到底总共需要5秒。你能试试5000秒吗。500相当于不到1秒。把500换成5000。我这样做了,但它不起作用。我也编辑了这个问题。