我正在使用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