@@ -111,60 +111,31 @@ class UIPageViewControllerImpl extends UIPageViewController {
111
111
112
112
public viewDidLayoutSubviews ( ) : void {
113
113
super . viewDidLayoutSubviews ( ) ;
114
-
115
114
const owner = this . _owner . get ( ) ;
115
+ if ( ! owner ) {
116
+ return ;
117
+ }
118
+
116
119
const tabsPosition = owner . tabsPosition ;
120
+ const parent = owner . parent ;
117
121
118
122
let tabBarTop = this . view . safeAreaInsets . top ;
119
123
let tabBarHeight = this . tabBar . frame . size . height ;
120
124
let scrollViewTop = this . tabBar . frame . size . height ;
121
- let scrollViewHeight = this . view . bounds . size . height - this . tabBar . frame . size . height + this . view . safeAreaInsets . bottom ;
125
+ let scrollViewHeight = this . view . bounds . size . height - this . tabBar . frame . size . height ;
126
+
127
+ if ( parent ) {
128
+ // TODO: Figure out a better way to handle ViewController nesting/Safe Area nesting
129
+ tabBarTop = Math . max ( this . view . safeAreaInsets . top , owner . parent . nativeView . safeAreaInsets . top ) ;
130
+ }
122
131
123
132
if ( tabsPosition === "bottom" ) {
124
133
tabBarTop = this . view . frame . size . height - this . tabBar . frame . size . height - this . view . safeAreaInsets . bottom ;
125
134
scrollViewTop = this . view . frame . origin . y ;
126
135
scrollViewHeight = this . view . frame . size . height - this . view . safeAreaInsets . bottom ;
127
136
}
128
137
129
- this . tabBar . frame = CGRectMake ( this . view . safeAreaInsets . left , tabBarTop , this . tabBar . frame . size . width , tabBarHeight ) ; //this.view.safeAreaLayoutGuide.layoutFrame;
130
- // this.additionalSafeAreaInsets = new UIEdgeInsets({ top: this.tabBar.frame.size.height, left: 0, bottom: 0, right: 0 });
131
- // const tabBar = MDCTabBar.alloc().initWithFrame(this.view.safeAreaLayoutGuide.layoutFrame);
132
-
133
- // tabBar.items = <NSArray<UITabBarItem>>NSArray.alloc().initWithArray([
134
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
135
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
136
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
137
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
138
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
139
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
140
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
141
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
142
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
143
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
144
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
145
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
146
- // ]);
147
-
148
- // tabBar.itemAppearance = MDCTabBarItemAppearance.Titles;
149
- // tabBar.tintColor = UIColor.greenColor;
150
- // tabBar.barTintColor = UIColor.yellowColor;
151
- // tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Normal);
152
- // tabBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin;
153
- // tabBar.sizeToFit();
154
- // this.view.addSubview(tabBar);
155
-
156
- // this.view.bringSubviewToFront(tabBar);
157
-
158
- // const tabBar = MDCTabBar.alloc().initWithFrame(this.view.bounds);
159
- // tabBar.items = <NSArray<UITabBarItem>>NSArray.alloc().initWithArray([
160
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
161
- // UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0)
162
- // ]);
163
-
164
- // tabBar.itemAppearance = MDCTabBarItemAppearance.Titles;
165
- // tabBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin;
166
- // tabBar.sizeToFit();
167
- // this.view.addSubview(tabBar);
138
+ this . tabBar . frame = CGRectMake ( this . view . safeAreaInsets . left , tabBarTop , this . tabBar . frame . size . width , tabBarHeight ) ;
168
139
169
140
const subViews : NSArray < UIView > = this . view . subviews ;
170
141
let scrollView : UIScrollView = null ;
@@ -192,47 +163,6 @@ class UIPageViewControllerImpl extends UIPageViewController {
192
163
193
164
scrollView . frame = CGRectMake ( this . view . safeAreaInsets . left , scrollViewTop , this . view . bounds . size . width , scrollViewHeight ) ; //this.view.bounds;
194
165
}
195
-
196
- // if (mdcBar) {
197
- // mdcBar.frame = this.view.bounds;
198
- // }
199
-
200
- // const owner = this.owner.get();
201
- // if (owner) {
202
- // if (majorVersion >= 11) {
203
- // // Handle nested UILayoutViewController safe area application.
204
- // // Currently, UILayoutViewController can be nested only in a TabView.
205
- // // The TabView itself is handled by the OS, so we check the TabView's parent (usually a Page, but can be a Layout).
206
- // const tabViewItem = owner.parent;
207
- // const tabView = tabViewItem && tabViewItem.parent;
208
- // let parent = tabView && tabView.parent;
209
-
210
- // // Handle Angular scenario where TabView is in a ProxyViewContainer
211
- // // It is possible to wrap components in ProxyViewContainers indefinitely
212
- // // Not using instanceof ProxyViewContainer to avoid circular dependency
213
- // // TODO: Try moving UILayoutViewController out of view module
214
- // while (parent && !parent.nativeViewProtected) {
215
- // parent = parent.parent;
216
- // }
217
-
218
- // if (parent) {
219
- // const parentPageInsetsTop = parent.nativeViewProtected.safeAreaInsets.top;
220
- // const currentInsetsTop = this.view.safeAreaInsets.top;
221
- // const additionalInsetsTop = Math.max(parentPageInsetsTop - currentInsetsTop, 0);
222
-
223
- // const parentPageInsetsBottom = parent.nativeViewProtected.safeAreaInsets.bottom;
224
- // const currentInsetsBottom = this.view.safeAreaInsets.bottom;
225
- // const additionalInsetsBottom = Math.max(parentPageInsetsBottom - currentInsetsBottom, 0);
226
-
227
- // if (additionalInsetsTop > 0 || additionalInsetsBottom > 0) {
228
- // const additionalInsets = new UIEdgeInsets({ top: additionalInsetsTop, left: 0, bottom: additionalInsetsBottom, right: 0 });
229
- // this.additionalSafeAreaInsets = additionalInsets;
230
- // }
231
- // }
232
- // }
233
-
234
- // layoutView(this, owner);
235
- // }
236
166
}
237
167
}
238
168
0 commit comments