feat: apply insets to absolute layout

This commit is contained in:
Vasil Chimev
2018-08-23 14:05:04 +03:00
committed by Martin Yankov
parent 12a9c5181e
commit c02f062457
3 changed files with 21 additions and 2 deletions

View File

@@ -47,13 +47,14 @@ export class AbsoluteLayout extends AbsoluteLayoutBase {
public onLayout(left: number, top: number, right: number, bottom: number): void {
super.onLayout(left, top, right, bottom);
const insets = this.getSafeAreaInsets();
this.eachLayoutChild((child, last) => {
const childWidth = child.getMeasuredWidth();
const childHeight = child.getMeasuredHeight();
const childLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + child.effectiveLeft;
const childTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + child.effectiveTop;
const childLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft + child.effectiveLeft + insets.left;
const childTop = this.effectiveBorderTopWidth + this.effectivePaddingTop + child.effectiveTop + insets.top;
const childRight = childLeft + childWidth + child.effectiveMarginLeft + child.effectiveMarginRight;
const childBottom = childTop + childHeight + child.effectiveMarginTop + child.effectiveMarginBottom;