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

Method measure

packages/core/ui/core/view/index.ios.ts:96–114  ·  view source on GitHub ↗
(widthMeasureSpec: number, heightMeasureSpec: number)

Source from the content-addressed store, hash-verified

94 }
95
96 public measure(widthMeasureSpec: number, heightMeasureSpec: number): void {
97 const measureSpecsChanged = this._setCurrentMeasureSpecs(widthMeasureSpec, heightMeasureSpec);
98 if (this.nativeViewProtected && (this.isLayoutRequested || measureSpecsChanged)) {
99 // first clears the measured dimension flag
100 this._privateFlags &= ~PFLAG_MEASURED_DIMENSION_SET;
101
102 // measure ourselves, this should set the measured dimension flag back
103 this.onMeasure(widthMeasureSpec, heightMeasureSpec);
104 this._privateFlags |= PFLAG_LAYOUT_REQUIRED;
105
106 // flag not set, setMeasuredDimension() was not invoked, we trace
107 // the exception to warn the developer
108 if ((this._privateFlags & PFLAG_MEASURED_DIMENSION_SET) !== PFLAG_MEASURED_DIMENSION_SET) {
109 if (Trace.isEnabled()) {
110 Trace.write('onMeasure() did not set the measured dimension by calling setMeasuredDimension() ' + this, Trace.categories.Layout, Trace.messageType.error);
111 }
112 }
113 }
114 }
115
116 @profile
117 public layout(left: number, top: number, right: number, bottom: number, setFrame = true): void {

Callers 9

measureHorizontalMethod · 0.95
measureVerticalMethod · 0.95
expandFlexItemsMethod · 0.95
shrinkFlexItemsMethod · 0.95
measureNativeViewFunction · 0.45
measureChildMethod · 0.45
layoutInternalMethod · 0.45
_applyBottomAccessoryMethod · 0.45
layoutSubviewsMethod · 0.45

Calls 3

onMeasureMethod · 0.95
isEnabledMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected