From fc6f843fdaa19927286003516401167c237b1a54 Mon Sep 17 00:00:00 2001 From: farfromrefuge Date: Sun, 11 Sep 2022 07:02:54 +0200 Subject: [PATCH] fix(ios): prevent creating `ActionBar` when not needed (#10017) --- packages/core/ui/page/index.ios.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/core/ui/page/index.ios.ts b/packages/core/ui/page/index.ios.ts index fd5eec0cb..fcc20fb74 100644 --- a/packages/core/ui/page/index.ios.ts +++ b/packages/core/ui/page/index.ios.ts @@ -407,7 +407,9 @@ 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 - this.actionBar.update(); + if (this.hasActionBar) { + this.actionBar.update(); + } this.updateStatusBar(); } @@ -446,7 +448,7 @@ export class Page extends PageBase { const height = layout.getMeasureSpecSize(heightMeasureSpec); const heightMode = layout.getMeasureSpecMode(heightMeasureSpec); - if (this.frame && this.frame._getNavBarVisible(this)) { + if (this.hasActionBar && this.frame && this.frame._getNavBarVisible(this)) { const { width, height } = this.actionBar._getActualSize; const widthSpec = layout.makeMeasureSpec(width, layout.EXACTLY); const heightSpec = layout.makeMeasureSpec(height, layout.EXACTLY); @@ -465,8 +467,10 @@ export class Page extends PageBase { } public onLayout(left: number, top: number, right: number, bottom: number) { - const { width: actionBarWidth, height: actionBarHeight } = this.actionBar._getActualSize; - View.layoutChild(this, this.actionBar, 0, 0, actionBarWidth, actionBarHeight); + if (this.hasActionBar) { + const { width: actionBarWidth, height: actionBarHeight } = this.actionBar._getActualSize; + View.layoutChild(this, this.actionBar, 0, 0, actionBarWidth, actionBarHeight); + } const insets = this.getSafeAreaInsets(); @@ -486,7 +490,7 @@ export class Page extends PageBase { public _addViewToNativeVisualTree(child: View, atIndex: number): boolean { // ActionBar is handled by the UINavigationController - if (child === this.actionBar) { + if (this.hasActionBar && child === this.actionBar) { return true; } @@ -518,7 +522,7 @@ export class Page extends PageBase { public _removeViewFromNativeVisualTree(child: View): void { // ActionBar is handled by the UINavigationController - if (child === this.actionBar) { + if (this.hasActionBar && child === this.actionBar) { return; }