@@ -3,8 +3,8 @@ import { Point, View as ViewDefinition } from ".";
33
44import { ios , Background } from "../../styling/background" ;
55import {
6- ViewCommon , layout , isEnabledProperty , originXProperty , originYProperty , automationTextProperty , isUserInteractionEnabledProperty ,
7- traceEnabled , traceWrite , traceCategories
6+ ViewCommon , layout , isEnabledProperty , originXProperty , originYProperty , automationTextProperty , isUserInteractionEnabledProperty ,
7+ traceEnabled , traceWrite , traceCategories
88} from "./view-common" ;
99
1010import {
@@ -100,35 +100,26 @@ export class View extends ViewCommon {
100100 }
101101
102102 public onMeasure ( widthMeasureSpec : number , heightMeasureSpec : number ) : void {
103- let view = this . nativeView ;
104- let nativeWidth = 0 ;
105- let nativeHeight = 0 ;
106-
107- let width = layout . getMeasureSpecSize ( widthMeasureSpec ) ;
108- let widthMode = layout . getMeasureSpecMode ( widthMeasureSpec ) ;
103+ const view = this . nativeView ;
104+ const width = layout . getMeasureSpecSize ( widthMeasureSpec ) ;
105+ const widthMode = layout . getMeasureSpecMode ( widthMeasureSpec ) ;
109106
110- let height = layout . getMeasureSpecSize ( heightMeasureSpec ) ;
111- let heightMode = layout . getMeasureSpecMode ( heightMeasureSpec ) ;
107+ const height = layout . getMeasureSpecSize ( heightMeasureSpec ) ;
108+ const heightMode = layout . getMeasureSpecMode ( heightMeasureSpec ) ;
112109
110+ let nativeWidth = 0 ;
111+ let nativeHeight = 0 ;
113112 if ( view ) {
114- if ( widthMode === layout . UNSPECIFIED ) {
115- width = Number . POSITIVE_INFINITY ;
116- }
117-
118- if ( heightMode === layout . UNSPECIFIED ) {
119- height = Number . POSITIVE_INFINITY ;
120- }
121-
122- let nativeSize = view . sizeThatFits ( CGSizeMake ( layout . toDeviceIndependentPixels ( width ) , layout . toDeviceIndependentPixels ( height ) ) ) ;
123- nativeWidth = layout . toDevicePixels ( nativeSize . width ) ;
124- nativeHeight = layout . toDevicePixels ( nativeSize . height ) ;
113+ const nativeSize = layout . measureNativeView ( view , width , widthMode , height , heightMode ) ;
114+ nativeWidth = nativeSize . width ;
115+ nativeHeight = nativeSize . height ;
125116 }
126117
127- let measureWidth = Math . max ( nativeWidth , this . effectiveMinWidth ) ;
128- let measureHeight = Math . max ( nativeHeight , this . effectiveMinHeight ) ;
118+ const measureWidth = Math . max ( nativeWidth , this . effectiveMinWidth ) ;
119+ const measureHeight = Math . max ( nativeHeight , this . effectiveMinHeight ) ;
129120
130- let widthAndState = View . resolveSizeAndState ( measureWidth , width , widthMode , 0 ) ;
131- let heightAndState = View . resolveSizeAndState ( measureHeight , height , heightMode , 0 ) ;
121+ const widthAndState = View . resolveSizeAndState ( measureWidth , width , widthMode , 0 ) ;
122+ const heightAndState = View . resolveSizeAndState ( measureHeight , height , heightMode , 0 ) ;
132123
133124 this . setMeasuredDimension ( widthAndState , heightAndState ) ;
134125 }
0 commit comments