mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix(core): ObservableArray splice ensure index is > 0 (#8921)
Otherwise it will crash in ListView for iOS for example as it tries to animate an item with a negative row index
This commit is contained in:
@ -246,7 +246,7 @@ export class ObservableArray<T> extends Observable {
|
|||||||
eventName: CHANGE,
|
eventName: CHANGE,
|
||||||
object: this,
|
object: this,
|
||||||
action: ChangeType.Splice,
|
action: ChangeType.Splice,
|
||||||
index: Math.min(start, this._array.length-1),
|
index: Math.max(Math.min(start, this._array.length-1), 0),
|
||||||
removed: result,
|
removed: result,
|
||||||
addedCount: this._array.length + result.length - length,
|
addedCount: this._array.length + result.length - length,
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user