@@ -82,6 +82,10 @@ function layoutView(controller: IUILayoutViewController, owner: View): void {
82
82
const widthSpec = Utils . layout . makeMeasureSpec ( safeAreaWidth , Utils . layout . EXACTLY ) ;
83
83
const heightSpec = Utils . layout . makeMeasureSpec ( safeAreaHeight , Utils . layout . UNSPECIFIED ) ;
84
84
85
+ owner . iosOverflowSafeArea = true ;
86
+
87
+ // reset _cachedFrame or it will wrongly move the view on subsequent layouts
88
+ ( owner as any ) . _cachedFrame = null ;
85
89
View . measureChild ( null , owner , widthSpec , heightSpec ) ;
86
90
const marginTop = owner . effectiveMarginTop ;
87
91
const marginBottom = owner . effectiveMarginBottom ;
@@ -91,8 +95,6 @@ function layoutView(controller: IUILayoutViewController, owner: View): void {
91
95
const width = owner . getMeasuredWidth ( ) ;
92
96
const height = owner . getMeasuredHeight ( ) ;
93
97
94
- owner . iosOverflowSafeArea = false ;
95
-
96
98
View . layoutChild ( null , owner , position . left , position . top , position . left + width , position . top + height ) ;
97
99
98
100
const effectiveWidth = width + marginLeft + marginRight ;
@@ -135,7 +137,7 @@ function layoutView(controller: IUILayoutViewController, owner: View): void {
135
137
owner . parent . _layoutParent ( ) ;
136
138
}
137
139
}
138
- function getAvailableSpaceFromParent ( view : View , frame : CGRect ) : { safeArea : CGRect ; fullscreen : CGRect ; inWindow : CGRect } {
140
+ function getAvailableSpaceFromParent ( view : View , frame : CGRect ) : { safeArea : CGRect ; fullscreen : CGRect } {
139
141
if ( ! view ) {
140
142
return null ;
141
143
}
@@ -170,18 +172,18 @@ function getAvailableSpaceFromParent(view: View, frame: CGRect): { safeArea: CGR
170
172
fullscreen = CGRectMake ( 0 , 0 , scrollView . contentSize . width , scrollView . contentSize . height ) ;
171
173
}
172
174
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;
176
178
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
+ // }
181
183
182
- const inWindow = CGRectMake ( inWindowLeft , inWindowTop , frame . size . width , frame . size . height ) ;
184
+ // const inWindow = CGRectMake(inWindowLeft, inWindowTop, frame.size.width, frame.size.height);
183
185
184
- return { safeArea, fullscreen, inWindow } ;
186
+ return { safeArea, fullscreen } ;
185
187
}
186
188
187
189
declare class IUILayoutViewController extends UIViewController {
@@ -210,7 +212,7 @@ class UILayoutViewController extends UIViewController {
210
212
super . viewDidLoad ( ) ;
211
213
212
214
// Unify translucent and opaque bars layout
213
- // this.edgesForExtendedLayout = UIRectEdgeBottom ;
215
+ this . edgesForExtendedLayout = UIRectEdge . All ;
214
216
this . extendedLayoutIncludesOpaqueBars = true ;
215
217
}
216
218
@@ -226,45 +228,45 @@ class UILayoutViewController extends UIViewController {
226
228
super . viewDidLayoutSubviews ( ) ;
227
229
const owner = this . owner . get ( ) ;
228
230
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
- }
264
231
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
+ // }
265
268
}
266
269
}
267
- viewLayedOut : boolean ;
268
270
269
271
viewWillAppear ( animated : boolean ) : void {
270
272
super . viewWillAppear ( animated ) ;
0 commit comments