Skip to content

Commit

Permalink
fix: 滚动更新条件
Browse files Browse the repository at this point in the history
  • Loading branch information
kongjing committed Mar 23, 2023
1 parent 651f27b commit e4c8725
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions packages/vantui/src/virtual-list/virtual-waterfall-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,20 @@ function VirtualWaterfallList_(
const startIndex = getClosestIndex_(leftRects, scrollTop) as number
const startIndexR = getClosestIndex_(rightRects, scrollTop) as number

if (leftRects[startIndex]) {
if (startIndex !== leftShowConfig.head) {
setLeftShowConfig({
head: startIndex,
tail: startIndex + step,
transformY: `translateY(${leftRects[startIndex].top}px)`,
})
}
if (leftRects[startIndex] && startIndex !== leftShowConfig.head) {
setLeftShowConfig({
head: startIndex,
tail: startIndex + step,
transformY: `translateY(${leftRects[startIndex].top}px)`,
})
}

if (startIndexR !== rightShowConfig.head) {
setRightShowConfig({
head: startIndexR,
tail: startIndexR + step,
transformY: `translateY(${rightRects[startIndexR].top}px)`,
})
}
if (rightRects[startIndexR] && startIndexR !== rightShowConfig.head) {
setRightShowConfig({
head: startIndexR,
tail: startIndexR + step,
transformY: `translateY(${rightRects[startIndexR].top}px)`,
})
}
}
},
Expand Down

0 comments on commit e4c8725

Please sign in to comment.