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,15 +214,9 @@ export class LazyListView extends ListView {
} }
_removeAdditionalElement(fromIdx, toIdx) { _removeAdditionalElement(fromIdx, toIdx) {
if (toIdx < fromIdx) { // If element comes from the bottom, remove element at bottom and vice versa
// Element comes from the bottom, so remove element at bottom const child = toIdx < fromIdx ? this._childInstances.pop() : this._childInstances.shift();
const child = this._childInstances.pop(); this._removeChild(child);
this._removeChild(child);
}
else {
const child = this._childInstances.shift();
this._removeChild(child);
}
} }
onMove(fromIdx, toIdx, value) { onMove(fromIdx, toIdx, value) {