feat(iOS): Safe Area Support (#6230)

This commit is contained in:
Vasil Chimev
2018-09-28 18:21:50 +03:00
committed by GitHub
parent 46705ee332
commit 982acdc168
39 changed files with 3189 additions and 863 deletions

View File

@@ -83,19 +83,21 @@ export class StackLayout extends StackLayoutBase {
public onLayout(left: number, top: number, right: number, bottom: number): void {
super.onLayout(left, top, right, bottom);
const insets = this.getSafeAreaInsets();
if (this.orientation === "vertical") {
this.layoutVertical(left, top, right, bottom);
this.layoutVertical(left, top, right, bottom, insets);
}
else {
this.layoutHorizontal(left, top, right, bottom);
this.layoutHorizontal(left, top, right, bottom, insets);
}
}
private layoutVertical(left: number, top: number, right: number, bottom: number): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom;
private layoutVertical(left: number, top: number, right: number, bottom: number, insets: {left, top, right, bottom}): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insets.left;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insets.top;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight + insets.right;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom + insets.bottom;
let childTop: number;
let childLeft: number = paddingLeft;
@@ -125,11 +127,11 @@ export class StackLayout extends StackLayoutBase {
})
}
private layoutHorizontal(left: number, top: number, right: number, bottom: number): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom;
private layoutHorizontal(left: number, top: number, right: number, bottom: number, insets: {left, top, right, bottom}): void {
const paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + insets.left;
const paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + insets.top;
const paddingRight = this.effectiveBorderRightWidth + this.effectivePaddingRight + insets.right;
const paddingBottom = this.effectiveBorderBottomWidth + this.effectivePaddingBottom + insets.bottom;
let childTop: number = paddingTop;
let childLeft: number;