我正在使用react-virtualized,并且尝试使用scrollToIndex特性,但是在使用它时我会得到一个空列表。(如果我滚动,那么我的列表将再次显示)。
这是我的代码:
<WindowScroller>
{({ height, isScrolling, scrollTop }) => (
<AutoSizer disableHeight>
{({ width }) => (
<List
autoHeight
height={height}
rowCount={lines.length}
rowRenderer={({ index, key, style }) => rowRenderer({ index, isScrolling, key, style, lines, onDelete, toggle })}
rowHeight={145}
scrollTop={scrollTop}
scrollToIndex={100}
width={width}
/>
)}
</AutoSizer>
)}
</WindowScroller>如果我删除scrollToIndex={100},一切都会正常运行。
scrollToIndex和WindowScroller一起工作吗?因为我只在List中找到了它的例子
发布于 2016-12-11 15:46:52
scrollToIndex和WindowScroller一起工作吗?因为我只找到了列表的例子
不幸的是,当使用WindowScroller时,此特性目前无法工作,因为WS控制滚动位置(而不是列表本身)。使用scrollToIndex,同时也使用WindowScroller,列表中会出现冲突的信息和情况。
这是一个曾经提过一两次的问题,也许这是我最终会尝试支持的问题。
编辑
由于9.8.0版本的,WindowScroller支持scrollToIndex道具。
https://stackoverflow.com/questions/41082422
复制相似问题