@@ -82,6 +82,10 @@ function layoutView(controller: IUILayoutViewController, owner: View): void {
8282 const widthSpec = Utils . layout . makeMeasureSpec ( safeAreaWidth , Utils . layout . EXACTLY ) ;
8383 const heightSpec = Utils . layout . makeMeasureSpec ( safeAreaHeight , Utils . layout . UNSPECIFIED ) ;
8484
85+ owner . iosOverflowSafeArea = true ;
86+
87+ // reset _cachedFrame or it will wrongly move the view on subsequent layouts
88+ ( owner as any ) . _cachedFrame = null ;
8589 View . measureChild ( null , owner , widthSpec , heightSpec ) ;
8690 const marginTop = owner . effectiveMarginTop ;
8791 const marginBottom = owner . effectiveMarginBottom ;
@@ -91,8 +95,6 @@ function layoutView(controller: IUILayoutViewController, owner: View): void {
9195 const width = owner . getMeasuredWidth ( ) ;
9296 const height = owner . getMeasuredHeight ( ) ;
9397
94- owner . iosOverflowSafeArea = false ;
95-
9698 View . layoutChild ( null , owner , position . left , position . top , position . left + width , position . top + height ) ;
9799
98100 const effectiveWidth = width + marginLeft + marginRight ;
@@ -135,7 +137,7 @@ function layoutView(controller: IUILayoutViewController, owner: View): void {
135137 owner . parent . _layoutParent ( ) ;
136138 }
137139}
138- function getAvailableSpaceFromParent ( view : View , frame : CGRect ) : { safeArea : CGRect ; fullscreen : CGRect ; inWindow : CGRect } {
140+ function getAvailableSpaceFromParent ( view : View , frame : CGRect ) : { safeArea : CGRect ; fullscreen : CGRect } {
139141 if ( ! view ) {
140142 return null ;
141143 }
@@ -170,18 +172,18 @@ function getAvailableSpaceFromParent(view: View, frame: CGRect): { safeArea: CGR
170172 fullscreen = CGRectMake ( 0 , 0 , scrollView . contentSize . width , scrollView . contentSize . height ) ;
171173 }
172174
173- const locationInWindow = view . getLocationInWindow ( ) ;
174- let inWindowLeft = locationInWindow . x ;
175- let inWindowTop = locationInWindow . y ;
175+ // const locationInWindow = view.getLocationInWindow();
176+ // let inWindowLeft = locationInWindow.x;
177+ // let inWindowTop = locationInWindow.y;
176178
177- if ( scrollView ) {
178- inWindowLeft += scrollView . contentOffset . x ;
179- inWindowTop += scrollView . contentOffset . y ;
180- }
179+ // if (scrollView) {
180+ // inWindowLeft += scrollView.contentOffset.x;
181+ // inWindowTop += scrollView.contentOffset.y;
182+ // }
181183
182- const inWindow = CGRectMake ( inWindowLeft , inWindowTop , frame . size . width , frame . size . height ) ;
184+ // const inWindow = CGRectMake(inWindowLeft, inWindowTop, frame.size.width, frame.size.height);
183185
184- return { safeArea, fullscreen, inWindow } ;
186+ return { safeArea, fullscreen } ;
185187}
186188
187189declare class IUILayoutViewController extends UIViewController {
@@ -210,7 +212,7 @@ class UILayoutViewController extends UIViewController {
210212 super . viewDidLoad ( ) ;
211213
212214 // Unify translucent and opaque bars layout
213- // this.edgesForExtendedLayout = UIRectEdgeBottom ;
215+ this . edgesForExtendedLayout = UIRectEdge . All ;
214216 this . extendedLayoutIncludesOpaqueBars = true ;
215217 }
216218
@@ -226,45 +228,45 @@ class UILayoutViewController extends UIViewController {
226228 super . viewDidLayoutSubviews ( ) ;
227229 const owner = this . owner . get ( ) ;
228230 if ( owner ) {
229- if ( majorVersion >= 11 ) {
230- // Handle nested UILayoutViewController safe area application.
231- // Currently, UILayoutViewController can be nested only in a TabView.
232- // The TabView itself is handled by the OS, so we check the TabView's parent (usually a Page, but can be a Layout).
233- const tabViewItem = owner . parent ;
234- const tabView = tabViewItem && tabViewItem . parent ;
235- let parent = tabView && tabView . parent ;
236-
237- // Handle Angular scenario where TabView is in a ProxyViewContainer
238- // It is possible to wrap components in ProxyViewContainers indefinitely
239- // Not using instanceof ProxyViewContainer to avoid circular dependency
240- // TODO: Try moving UILayoutViewController out of view module
241- while ( parent && ! parent . nativeViewProtected ) {
242- parent = parent . parent ;
243- }
244- const additionalInsets = { top : 0 , left : 0 , bottom : 0 , right : 0 } ;
245-
246- if ( parent ) {
247- const parentPageInsetsTop = parent . nativeViewProtected . safeAreaInsets . top ;
248- const currentInsetsTop = this . view . safeAreaInsets . top ;
249- const additionalInsetsTop = Math . max ( parentPageInsetsTop - currentInsetsTop , 0 ) ;
250-
251- const parentPageInsetsBottom = parent . nativeViewProtected . safeAreaInsets . bottom ;
252- const currentInsetsBottom = this . view . safeAreaInsets . bottom ;
253- const additionalInsetsBottom = Math . max ( parentPageInsetsBottom - currentInsetsBottom , 0 ) ;
254-
255- if ( additionalInsetsTop > 0 || additionalInsetsBottom > 0 ) {
256- additionalInsets . top = additionalInsetsTop ;
257- additionalInsets . bottom = additionalInsetsBottom ;
258- }
259- }
260-
261- const insets = new UIEdgeInsets ( additionalInsets ) ;
262- this . additionalSafeAreaInsets = insets ;
263- }
264231 layoutView ( this , owner ) ;
232+ // if (majorVersion >= 11) {
233+ // // Handle nested UILayoutViewController safe area application.
234+ // // Currently, UILayoutViewController can be nested only in a TabView.
235+ // // The TabView itself is handled by the OS, so we check the TabView's parent (usually a Page, but can be a Layout).
236+ // const tabViewItem = owner.parent;
237+ // const tabView = tabViewItem && tabViewItem.parent;
238+ // let parent = tabView && tabView.parent;
239+
240+ // // Handle Angular scenario where TabView is in a ProxyViewContainer
241+ // // It is possible to wrap components in ProxyViewContainers indefinitely
242+ // // Not using instanceof ProxyViewContainer to avoid circular dependency
243+ // // TODO: Try moving UILayoutViewController out of view module
244+ // while (parent && !parent.nativeViewProtected) {
245+ // parent = parent.parent;
246+ // }
247+ // const additionalInsets = { top: 0, left: 0, bottom: 0, right: 0 };
248+
249+ // if (parent) {
250+ // const parentPageInsetsTop = parent.nativeViewProtected.safeAreaInsets.top;
251+ // const currentInsetsTop = this.view.safeAreaInsets.top;
252+ // const additionalInsetsTop = Math.max(parentPageInsetsTop - currentInsetsTop, 0);
253+
254+ // const parentPageInsetsBottom = parent.nativeViewProtected.safeAreaInsets.bottom;
255+ // const currentInsetsBottom = this.view.safeAreaInsets.bottom;
256+ // const additionalInsetsBottom = Math.max(parentPageInsetsBottom - currentInsetsBottom, 0);
257+
258+ // if (additionalInsetsTop > 0 || additionalInsetsBottom > 0) {
259+ // additionalInsets.top = additionalInsetsTop;
260+ // additionalInsets.bottom = additionalInsetsBottom;
261+ // }
262+ // }
263+
264+ // const insets = new UIEdgeInsets(additionalInsets);
265+ // this.additionalSafeAreaInsets = insets;
266+ // console.log('additionalSafeAreaInsets', insets.left, insets.bottom, insets.right, insets.top);
267+ // }
265268 }
266269 }
267- viewLayedOut : boolean ;
268270
269271 viewWillAppear ( animated : boolean ) : void {
270272 super . viewWillAppear ( animated ) ;
0 commit comments