MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / _addView

Function _addView

packages/core/ui/core/view-base/index.ts:986–1008  ·  view source on GitHub ↗
(view: ViewBase, atIndex?: number)

Source from the content-addressed store, hash-verified

984
985 @profile
986 public _addView(view: ViewBase, atIndex?: number) {
987 if (Trace.isEnabled()) {
988 Trace.write(`${this}._addView(${view}, ${atIndex})`, Trace.categories.ViewHierarchy);
989 }
990
991 if (!view) {
992 throw new Error('Expecting a valid View instance.');
993 }
994 if (!(view instanceof ViewBase)) {
995 throw new Error(view + ' is not a valid View instance.');
996 }
997 if (view.parent) {
998 throw new Error('View already has a parent. View: ' + view + ' Parent: ' + view.parent);
999 }
1000
1001 view.parent = this;
1002 this._addViewCore(view, atIndex);
1003 view._parentChanged(null);
1004
1005 if (this.domNode) {
1006 this.domNode.onChildAdded(view);
1007 }
1008 }
1009
1010 /**
1011 * Method is intended to be overridden by inheritors and used as "protected"

Callers

nothing calls this directly

Calls 4

isEnabledMethod · 0.80
onChildAddedMethod · 0.80
writeMethod · 0.65
_parentChangedMethod · 0.45

Tested by

no test coverage detected