Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion packages/core/ui/page/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ class UIViewControllerImpl extends UIViewController {

public isBackstackSkipped: boolean;
public isBackstackCleared: boolean;
private _isRunningLayout = 0;
Comment thread
CatchABus marked this conversation as resolved.
Resolved
private get isRunningLayout() {
return this._isRunningLayout === 0;
Comment thread
CatchABus marked this conversation as resolved.
Resolved
}
private startRunningLayout() {
this._isRunningLayout++;
}
private finishRunningLayout() {
this._isRunningLayout--;
}
private runLayout(cb: () => void) {
try {
this.startRunningLayout();
cb();
} finally {
this.finishRunningLayout();
}
}

public static initWithOwner(owner: WeakRef<Page>): UIViewControllerImpl {
const controller = <UIViewControllerImpl>UIViewControllerImpl.new();
Expand Down Expand Up @@ -254,7 +272,19 @@ class UIViewControllerImpl extends UIViewController {
}
}

public viewSafeAreaInsetsDidChange(): void {
super.viewSafeAreaInsetsDidChange();
if (this.isRunningLayout) {
return;
}
const owner = this._owner.get();
if (owner) {
this.runLayout(() => IOSHelper.layoutView(this, owner));
}
}

public viewDidLayoutSubviews(): void {
this.startRunningLayout();
super.viewDidLayoutSubviews();
const owner = this._owner.get();
if (owner) {
Expand Down Expand Up @@ -306,6 +336,7 @@ class UIViewControllerImpl extends UIViewController {

IOSHelper.layoutView(this, owner);
}
this.finishRunningLayout();
}

// Mind implementation for other controllerss
Expand Down Expand Up @@ -407,7 +438,7 @@ export class Page extends PageBase {
updateWithWillAppear(animated: boolean) {
// this method is important because it allows plugins to react to modal page close
// for example allowing updating status bar background color
if (this.hasActionBar) {
if (this.hasActionBar) {
this.actionBar.update();
}
this.updateStatusBar();
Expand Down