fix: 修复消息过多滚动到上面下滚动到底部会导致渲染不正确的bug

pull/13/head
moonrailgun 4 years ago
parent 73bf642325
commit 68752a654a

@ -653,7 +653,7 @@ export default class DynamicSizeList extends PureComponent<
/** /**
* *
*/ */
_getRangeToRender(scrollTop = 0): number[] { _getRangeToRender(scrollTop?: number): number[] {
const { itemData, overscanCountForward, overscanCountBackward } = const { itemData, overscanCountForward, overscanCountBackward } =
this.props; this.props;
const { scrollDirection, scrollOffset } = this.state; const { scrollDirection, scrollOffset } = this.state;
@ -662,7 +662,10 @@ export default class DynamicSizeList extends PureComponent<
if (itemCount === 0) { if (itemCount === 0) {
return [0, 0, 0, 0]; return [0, 0, 0, 0];
} }
const scrollOffsetValue = scrollTop >= 0 ? scrollTop : scrollOffset; const scrollOffsetValue =
typeof scrollTop === 'number' && scrollTop >= 0
? scrollTop
: scrollOffset;
const startIndex = getStartIndexForOffset( const startIndex = getStartIndexForOffset(
this.props, this.props,
scrollOffsetValue, scrollOffsetValue,

Loading…
Cancel
Save