Do not break onListChanged
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
5d54285640
commit
33ac34b04e
1 changed files with 6 additions and 2 deletions
|
@ -162,6 +162,7 @@ export class LazyListView extends ListView {
|
|||
onAdd(idx, value) {
|
||||
const {topCount, renderCount, bottomCount} = this._renderRange;
|
||||
if (this._renderRange.containsIndex(idx)) {
|
||||
this.onBeforeListChanged();
|
||||
const normalizedIdx = this._renderRange.normalize(idx);
|
||||
if (bottomCount === 0) {
|
||||
/*
|
||||
|
@ -179,7 +180,8 @@ export class LazyListView extends ListView {
|
|||
this._removeChild(this._childInstances.pop());
|
||||
this._renderRange = new ItemRange(topCount, renderCount, bottomCount + 1);
|
||||
}
|
||||
super.onAdd(normalizedIdx, value);
|
||||
super.onAdd(normalizedIdx, value, true);
|
||||
this.onListChanged();
|
||||
}
|
||||
else {
|
||||
this._renderRange = idx < topCount ? new ItemRange(topCount + 1, renderCount, bottomCount):
|
||||
|
@ -191,8 +193,9 @@ export class LazyListView extends ListView {
|
|||
onRemove(idx, value) {
|
||||
const {topCount, renderCount, bottomCount} = this._renderRange;
|
||||
if (this._renderRange.containsIndex(idx)) {
|
||||
this.onBeforeListChanged();
|
||||
const normalizedIdx = this._renderRange.normalize(idx);
|
||||
super.onRemove(normalizedIdx, value);
|
||||
super.onRemove(normalizedIdx, value, true);
|
||||
if (bottomCount === 0) {
|
||||
// See onAdd for explanation
|
||||
this._renderRange = new ItemRange(topCount, renderCount - 1, bottomCount);
|
||||
|
@ -203,6 +206,7 @@ export class LazyListView extends ListView {
|
|||
this._root.appendChild(mountView(child, this._mountArgs));
|
||||
this._renderRange = new ItemRange(topCount, renderCount, bottomCount - 1);
|
||||
}
|
||||
this.onListChanged();
|
||||
}
|
||||
else {
|
||||
this._renderRange = idx < topCount ? new ItemRange(topCount - 1, renderCount, bottomCount):
|
||||
|
|
Reference in a new issue