1
我有一個工作的虛擬滾動網格,以在頁面上按部分顯示文檔。我現在爲搜索結果添加了另一個房車,但由於某種原因,當我向下滾動時,內容會滾動出來!我試圖簡化它只使用一個預定高度的List並消除潛在因素,它仍然給了我這個奇怪的錯誤。代碼本身按預期工作,它是表現出來的列表。 (我實際上使用Cell Measurer來獲取行高,但即使使用以下版本,它也會起作用)。 下面是代碼:React虛擬化列表滾動出視圖
const rowRenderer = ({ index, isScrolling, style, key }) =>
this.resultRowRenderer(index, key, style, curList)
resultRowRenderer(index, key, style, list) {
...
return <Markup content={quote} onClick={() => jumpToLocCallback(location)} />
}
render() {
...
const renderList = (curList, i) => {
const rowCount = curList.results.length
return (
<List
key={i}
height={100}
rowHeight={30}
rowCount={rowCount}
rowRenderer={rowRenderer}
overscanRowCount={0}
width={700}
ref={(ref) => this.List = ref}
/>
)
}
const renderLists = searchResultsLists.map(renderList)
return (
<div className='results-sidebar'>
{renderLists}
</div>
)
}
感謝
哇魔法!我錯過了Style標籤!那太惱人了 - 我花了幾個小時試圖調試這個。謝謝 – Relman