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

Function setNativeView

packages/core/ui/core/view-base/index.ts:1242–1258  ·  view source on GitHub ↗

* Set the nativeView field performing extra checks and updates to the native properties on the new view. * Use in cases where the createNativeView is not suitable. * As an example use in item controls where the native parent view will create the native views for child items.

(value: any)

Source from the content-addressed store, hash-verified

1240 * As an example use in item controls where the native parent view will create the native views for child items.
1241 */
1242 setNativeView(value: any): void {
1243 if (this.__nativeView === value) {
1244 return;
1245 }
1246
1247 if (this.__nativeView) {
1248 this._suspendNativeUpdates(SuspendType.NativeView);
1249 // We may do a `this.resetNativeView()` here?
1250 }
1251
1252 this.__nativeView = this.nativeViewProtected = value;
1253 if (this.__nativeView) {
1254 this._suspendedUpdates = undefined;
1255 this.initNativeView();
1256 this._resumeNativeUpdates(SuspendType.NativeView);
1257 }
1258 }
1259
1260 /**
1261 * Tears down the UI of a reusable node by making it no longer reusable.

Callers

nothing calls this directly

Calls 1

initNativeViewMethod · 0.45

Tested by

no test coverage detected