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

Method onMeasure

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

Source from the content-addressed store, hash-verified

174
175 @profile
176 public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
177 const view = this.nativeViewProtected;
178 const width = layout.getMeasureSpecSize(widthMeasureSpec);
179 const widthMode = layout.getMeasureSpecMode(widthMeasureSpec);
180
181 const height = layout.getMeasureSpecSize(heightMeasureSpec);
182 const heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
183
184 let nativeWidth = 0;
185 let nativeHeight = 0;
186 if (view) {
187 const nativeSize = layout.measureNativeView(view, width, widthMode, height, heightMode);
188 nativeWidth = nativeSize.width;
189 nativeHeight = nativeSize.height;
190 }
191
192 const measureWidth = Math.max(nativeWidth, this.effectiveMinWidth);
193 const measureHeight = Math.max(nativeHeight, this.effectiveMinHeight);
194
195 const widthAndState = View.resolveSizeAndState(measureWidth, width, widthMode, 0);
196 const heightAndState = View.resolveSizeAndState(measureHeight, height, heightMode, 0);
197
198 this.setMeasuredDimension(widthAndState, heightAndState);
199 }
200
201 public onLayout(left: number, top: number, right: number, bottom: number): void {
202 //

Callers 1

measureMethod · 0.95

Calls 2

setMeasuredDimensionMethod · 0.95
resolveSizeAndStateMethod · 0.45

Tested by

no test coverage detected