@@ -9,7 +9,7 @@ import { Color } from "tns-core-modules/color";
99import * as imageSource from 'tns-core-modules/image-source' ;
1010import { Point } from "tns-core-modules/ui/core/view" ;
1111import { Image } from "tns-core-modules/ui/image" ;
12- import { GC } from "utils/utils"
12+ import { GC , layout } from "utils/utils"
1313
1414export * from "./map-view-common" ;
1515
@@ -175,17 +175,41 @@ class MapViewDelegateImpl extends NSObject implements GMSMapViewDelegate {
175175 if ( Number . isNaN ( height ) ) height = null ;
176176
177177 if ( ! height || ! width ) {
178- const bounds : CGRect = require ( "utils/utils" ) . ios . getter ( UIScreen , UIScreen . mainScreen ) . bounds ;
178+ const bounds : CGRect = UIScreen . mainScreen . bounds ;
179179 width = width || ( bounds . size . width * .7 ) ;
180180 height = height || ( bounds . size . height * .4 ) ;
181181 }
182182
183- require ( "ui/utils" ) . ios . _layoutRootView ( content , CGRectMake ( 0 , 0 , width , height ) )
183+ this . _layoutRootView ( content , CGRectMake ( 0 , 0 , width , height ) )
184184 return content . ios ;
185185 }
186186
187187 return null ;
188188 }
189+
190+ /*
191+ Replacement for _layoutRootView method removed in NativeScript 6
192+ */
193+ private _layoutRootView ( rootView , parentBounds ) {
194+ if ( ! rootView || ! parentBounds ) {
195+ return ;
196+ }
197+
198+ const size = parentBounds . size ;
199+ const width = layout . toDevicePixels ( size . width ) ;
200+ const height = layout . toDevicePixels ( size . height ) ;
201+
202+ const widthSpec = layout . makeMeasureSpec ( width , layout . EXACTLY ) ;
203+ const heightSpec = layout . makeMeasureSpec ( height , layout . EXACTLY ) ;
204+
205+ rootView . measure ( widthSpec , heightSpec ) ;
206+
207+ const origin = parentBounds . origin ;
208+ const left = origin . x ;
209+ const top = origin . y ;
210+
211+ rootView . layout ( left , top , width , height ) ;
212+ }
189213}
190214
191215
0 commit comments