| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -698,16 +698,18 @@ export namespace ios { | |||
| 698 | 698 | } | |
| 699 | 699 | ||
| 700 | 700 | export function layoutView(controller: UIViewController, owner: View): void { | |
| 701 | - // apply parent page additional top insets if any. The scenario is when there is a parent page with action bar. | ||
| 702 | - const parentPage = getAncestor(owner, "Page"); | ||
| 703 | - if (parentPage) { | ||
| 704 | - const parentPageInsetsTop = parentPage.viewController.view.safeAreaInsets.top; | ||
| 705 | - const currentInsetsTop = controller.view.safeAreaInsets.top; | ||
| 706 | - const additionalInsetsTop = parentPageInsetsTop - currentInsetsTop; | ||
| 707 | - | ||
| 708 | - if (additionalInsetsTop > 0) { | ||
| 709 | - const additionalInsets = new UIEdgeInsets({ top: additionalInsetsTop, left: 0, bottom: 0, right: 0 }); | ||
| 710 | - controller.additionalSafeAreaInsets = additionalInsets; | ||
| 701 | + if (majorVersion >= 11) { | ||
| 702 | + // apply parent page additional top insets if any. The scenario is when there is a parent page with action bar. | ||
| 703 | + const parentPage = getAncestor(owner, "Page"); | ||
| 704 | + if (parentPage) { | ||
| 705 | + const parentPageInsetsTop = parentPage.viewController.view.safeAreaInsets.top; | ||
| 706 | + const currentInsetsTop = controller.view.safeAreaInsets.top; | ||
| 707 | + const additionalInsetsTop = parentPageInsetsTop - currentInsetsTop; | ||
| 708 | + | ||
| 709 | + if (additionalInsetsTop > 0) { | ||
| 710 | + const additionalInsets = new UIEdgeInsets({ top: additionalInsetsTop, left: 0, bottom: 0, right: 0 }); | ||
| 711 | + controller.additionalSafeAreaInsets = additionalInsets; | ||
| 712 | + } | ||
| 711 | 713 | } | |
| 712 | 714 | } | |
| 713 | 715 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,12 +9,15 @@ import { | |||
| 9 | 9 | } from "./page-common"; | |
| 10 | 10 | ||
| 11 | 11 | import { profile } from "../../profiling"; | |
| 12 | + import { ios as iosUtils } from "../../utils/utils"; | ||
| 12 | 13 | ||
| 13 | 14 | export * from "./page-common"; | |
| 14 | 15 | ||
| 15 | 16 | const ENTRY = "_entry"; | |
| 16 | 17 | const DELEGATE = "_delegate"; | |
| 17 | 18 | ||
| 19 | + const majorVersion = iosUtils.MajorVersion; | ||
| 20 | + | ||
| 18 | 21 | function isBackNavigationTo(page: Page, entry): boolean { | |
| 19 | 22 | const frame = page.frame; | |
| 20 | 23 | if (!frame) { | |
@@ -315,10 +318,23 @@ export class Page extends PageBase { | |||
| 315 | 318 | ||
| 316 | 319 | const insets = this.getSafeAreaInsets(); | |
| 317 | 320 | ||
| 321 | + if (majorVersion <= 10) { | ||
| 322 | + // iOS 10 and below don't have safe area insets API, | ||
| 323 | + // there we need only the top inset on the Page | ||
| 324 | + insets.top = layout.round(layout.toDevicePixels(this.viewController.view.safeAreaLayoutGuide.layoutFrame.origin.y)); | ||
| 325 | + } | ||
| 326 | + | ||
| 318 | 327 | const childLeft = 0 + insets.left; | |
| 319 | 328 | const childTop = 0 + insets.top; | |
| 320 | - const childRight = right - left - insets.right; | ||
| 321 | - const childBottom = bottom - top - insets.bottom; | ||
| 329 | + const childRight = right - insets.right; | ||
| 330 | + let childBottom = bottom - insets.bottom; | ||
| 331 | + | ||
| 332 | + if (majorVersion >= 11 && this.actionBar.flat) { | ||
| 333 | + // on iOS 11 the flat action bar changes the fullscreen size | ||
| 334 | + // the top of the page is the new fullscreen | ||
| 335 | + childBottom -= top; | ||
| 336 | + } | ||
| 337 | + | ||
| 322 | 338 | View.layoutChild(this, this.layoutView, childLeft, childTop, childRight, childBottom); | |
| 323 | 339 | } | |
| 324 | 340 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments