feat:fix when continious reset list,then getBatchedItems will continious call twice

This commit is contained in:
pengfei.zhou 2020-03-24 16:13:59 +08:00 committed by osborn
parent 4ea6da2d0a
commit e46f09427b

View File

@ -89,12 +89,9 @@ export class List extends Superview implements IList {
this.itemCount = 0
}
private getItem(itemIdx: number) {
let view = this.cachedViews.get(`${itemIdx}`)
if (view === undefined) {
view = this.renderItem(itemIdx)
view.superview = this
this.cachedViews.set(`${itemIdx}`, view)
}
let view = this.renderItem(itemIdx)
view.superview = this
this.cachedViews.set(`${itemIdx}`, view)
return view
}
@ -108,7 +105,7 @@ export class List extends Superview implements IList {
}
private renderBunchedItems(start: number, length: number) {
this.ignoreDirtyCallOnce = true;
this.ignoreDirtyCallOnce = true
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx)
return listItem.toModel()