Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/438.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
Javascript 如何在react native';s实验窗口ListView_Javascript_React Native_Scroll - Fatal编程技术网

Javascript 如何在react native';s实验窗口ListView

Javascript 如何在react native';s实验窗口ListView,javascript,react-native,scroll,Javascript,React Native,Scroll,我想在react native的实验性WindowedListView组件上实现一个滚动恢复机制 我尝试使用scrollTo函数设置底层ScrollView滚动位置,但是WindowedListView本身没有滚动到正确的位置。我怀疑原因是它以增量方式呈现行,因此它不会直接显示目标行 // WindowedListViewSource - refer to https://github.com/facebook/react-native/blob/master/Libraries/Experi

我想在react native的实验性WindowedListView组件上实现一个滚动恢复机制

我尝试使用
scrollTo
函数设置底层ScrollView滚动位置,但是WindowedListView本身没有滚动到正确的位置。我怀疑原因是它以增量方式呈现行,因此它不会直接显示目标行


// WindowedListViewSource - refer to https://github.com/facebook/react-native/blob/master/Libraries/Experimental/WindowedListView.js
componentDidMount() {
    this._scrollRef &&
      this._scrollRef.scrollToOffset &&
      this._scrollRef.scrollToOffset({offset, animated});
} // this didn't work :(
预期结果应呈现列表,并滚动至正确的位置/偏移

实际的结果是,列表被滚动,但没有滚动到正确的位置——距离顶部只有10-20px,但没有任何错误消息