React虚拟化-scrollToIndex不适用于WindowScroller

Ana*_*nas 1 reactjs react-virtualized

我正在使用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>
Run Code Online (Sandbox Code Playgroud)

如果我删除 scrollToIndex={100},一切正常。

请问scrollToIndex作品用WindowScroller?因为我只发现了List

bva*_*ghn 5

scrollToIndex是否可以与WindowScroller一起使用?因为我只在List中找到了它的示例

不幸的是,当使用WindowScroller时,此功能当前不起作用,因为WS控制滚动位置(而不是List本身)。在同时使用WindowScroller的同时使用scrollToIndex可以使List发生冲突信息,并且事情中断。

这个问题之前已经提出过一两次,所以也许这是我最终会尝试支持的问题。

编辑

9.8.0开始,WindowScroller支持scrollToIndex属性。