Improve code

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-07-16 13:39:02 +05:30
parent 829830c0fa
commit 0bd1d2b291

View file

@ -214,16 +214,10 @@ export class LazyListView extends ListView {
}
_removeAdditionalElement(fromIdx, toIdx) {
if (toIdx < fromIdx) {
// Element comes from the bottom, so remove element at bottom
const child = this._childInstances.pop();
// If element comes from the bottom, remove element at bottom and vice versa
const child = toIdx < fromIdx ? this._childInstances.pop() : this._childInstances.shift();
this._removeChild(child);
}
else {
const child = this._childInstances.shift();
this._removeChild(child);
}
}
onMove(fromIdx, toIdx, value) {
const fromInRange = this._renderRange.containsIndex(fromIdx);