@@ -11,7 +11,7 @@ import { Font } from "../styling/font";
11
11
import { Frame } from "../frame" ;
12
12
import { ios as iosView , View } from "../core/view" ;
13
13
import { Color } from "../../color" ;
14
- import { /* ios as iosUtils,*/ layout , isFontIconURI } from "../../utils/utils" ;
14
+ import { ios as iosUtils , layout , isFontIconURI } from "../../utils/utils" ;
15
15
// import { device } from "../../platform";
16
16
import { fromFileOrResource , fromFontIconCode , ImageSource } from "../../image-source" ;
17
17
@@ -20,7 +20,7 @@ import { fromFileOrResource, fromFontIconCode, ImageSource } from "../../image-s
20
20
21
21
export * from "./tabs-common" ;
22
22
23
- // const majorVersion = iosUtils.MajorVersion;
23
+ const majorVersion = iosUtils . MajorVersion ;
24
24
// const isPhone = device.deviceType === "Phone";
25
25
26
26
class MDCTabBarDelegateImpl extends NSObject implements MDCTabBarDelegate {
@@ -106,6 +106,8 @@ class UIPageViewControllerImpl extends UIPageViewController {
106
106
return ;
107
107
}
108
108
109
+ iosView . updateAutoAdjustScrollInsets ( this , owner ) ;
110
+
109
111
// Tabs can be reset as a root view. Call loaded here in this scenario.
110
112
if ( ! owner . isLoaded ) {
111
113
owner . callLoaded ( ) ;
@@ -119,29 +121,39 @@ class UIPageViewControllerImpl extends UIPageViewController {
119
121
return ;
120
122
}
121
123
124
+ let safeAreaInsetsBottom = 0 ;
125
+ let safeAreaInsetsTop = 0 ;
126
+
127
+ if ( majorVersion > 10 ) {
128
+ safeAreaInsetsBottom = this . view . safeAreaInsets . bottom ;
129
+ safeAreaInsetsTop = this . view . safeAreaInsets . top ;
130
+ } else {
131
+ safeAreaInsetsTop = this . topLayoutGuide . length ;
132
+ }
133
+
122
134
let scrollViewTop = 0 ;
123
- let scrollViewHeight = this . view . bounds . size . height + this . view . safeAreaInsets . bottom ;
135
+ let scrollViewHeight = this . view . bounds . size . height + safeAreaInsetsBottom ;
124
136
125
137
if ( owner . tabStrip ) {
126
138
scrollViewTop = this . tabBar . frame . size . height ;
127
- scrollViewHeight = this . view . bounds . size . height - this . tabBar . frame . size . height + this . view . safeAreaInsets . bottom ;
128
- let tabBarTop = this . view . safeAreaInsets . top ;
139
+ scrollViewHeight = this . view . bounds . size . height - this . tabBar . frame . size . height + safeAreaInsetsBottom ;
140
+ let tabBarTop = safeAreaInsetsTop ;
129
141
let tabBarHeight = this . tabBar . frame . size . height ;
130
142
131
143
const tabsPosition = owner . tabsPosition ;
132
144
if ( tabsPosition === "bottom" ) {
133
- tabBarTop = this . view . frame . size . height - this . tabBar . frame . size . height - this . view . safeAreaInsets . bottom ;
145
+ tabBarTop = this . view . frame . size . height - this . tabBar . frame . size . height - safeAreaInsetsBottom ;
134
146
scrollViewTop = this . view . frame . origin . y ;
135
- scrollViewHeight = this . view . frame . size . height - this . view . safeAreaInsets . bottom ;
147
+ scrollViewHeight = this . view . frame . size . height - safeAreaInsetsBottom ;
136
148
}
137
149
138
150
const parent = owner . parent ;
139
- if ( parent ) {
151
+ if ( parent && majorVersion > 10 ) {
140
152
// TODO: Figure out a better way to handle ViewController nesting/Safe Area nesting
141
153
tabBarTop = Math . max ( tabBarTop , owner . parent . nativeView . safeAreaInsets . top ) ;
142
154
}
143
155
144
- this . tabBar . frame = CGRectMake ( this . view . safeAreaInsets . left , tabBarTop , this . tabBar . frame . size . width , tabBarHeight ) ;
156
+ this . tabBar . frame = CGRectMake ( 0 , tabBarTop , this . tabBar . frame . size . width , tabBarHeight ) ;
145
157
}
146
158
147
159
const subViews : NSArray < UIView > = this . view . subviews ;
@@ -163,7 +175,7 @@ class UIPageViewControllerImpl extends UIPageViewController {
163
175
scrollView . scrollEnabled = false ;
164
176
}
165
177
166
- scrollView . frame = CGRectMake ( this . view . safeAreaInsets . left , scrollViewTop , this . view . bounds . size . width , scrollViewHeight ) ; //this.view.bounds;
178
+ scrollView . frame = CGRectMake ( 0 , scrollViewTop , this . view . bounds . size . width , scrollViewHeight ) ; //this.view.bounds;
167
179
}
168
180
}
169
181
}
0 commit comments