Skip to content

Commit

Permalink
fix(components): 修正虚拟列表 VirtualList 滚动时抖动的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Leechael committed Jul 17, 2020
1 parent 3e3a447 commit 5b1718a
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ export default function createListComponent ({
} = this.props
const {
isScrolling,
scrollOffset
scrollOffset,
scrollUpdateWasRequested
} = this.state // TODO Deprecate direction "horizontal"

const isHorizontal = direction === 'horizontal' || layout === 'horizontal'
Expand Down Expand Up @@ -388,10 +389,12 @@ export default function createListComponent ({
...style
}
}
if (isHorizontal) {
outerElementProps.scrollLeft = scrollOffset
} else {
outerElementProps.scrollTop = scrollOffset
if (scrollUpdateWasRequested) {
if (isHorizontal) {
outerElementProps.scrollLeft = scrollOffset
} else {
outerElementProps.scrollTop = scrollOffset
}
}
return createElement(outerElementType || outerTagName || 'div', outerElementProps, createElement(innerElementType || innerTagName || 'div', {
children: items,
Expand Down

0 comments on commit 5b1718a

Please sign in to comment.