fix(core): ignore inserting child if < 0 (#10690)

This commit is contained in:
Nathan Walker
2025-02-05 09:59:30 -08:00
committed by GitHub
parent 3a7206fc3b
commit 2305511187
4 changed files with 29 additions and 23 deletions

View File

@ -49,14 +49,14 @@ export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefi
this._registerLayoutChild(child);
}
public insertChild(child: View, atIndex: number): void {
if (atIndex < 0) {
throw new Error('Cannot insert a child to a negative index.');
public insertChild(child: View, atIndex: number): boolean {
if (atIndex > -1) {
this._subViews.splice(atIndex, 0, child);
this._addView(child, atIndex);
this._registerLayoutChild(child);
return true;
}
this._subViews.splice(atIndex, 0, child);
this._addView(child, atIndex);
this._registerLayoutChild(child);
return false;
}
public removeChild(child: View): void {