mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
fix(ios): prevent creating ActionBar
when not needed (#10017)
This commit is contained in:
@ -407,7 +407,9 @@ export class Page extends PageBase {
|
|||||||
updateWithWillAppear(animated: boolean) {
|
updateWithWillAppear(animated: boolean) {
|
||||||
// this method is important because it allows plugins to react to modal page close
|
// this method is important because it allows plugins to react to modal page close
|
||||||
// for example allowing updating status bar background color
|
// for example allowing updating status bar background color
|
||||||
|
if (this.hasActionBar) {
|
||||||
this.actionBar.update();
|
this.actionBar.update();
|
||||||
|
}
|
||||||
this.updateStatusBar();
|
this.updateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +448,7 @@ export class Page extends PageBase {
|
|||||||
const height = layout.getMeasureSpecSize(heightMeasureSpec);
|
const height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||||
const heightMode = layout.getMeasureSpecMode(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 { width, height } = this.actionBar._getActualSize;
|
||||||
const widthSpec = layout.makeMeasureSpec(width, layout.EXACTLY);
|
const widthSpec = layout.makeMeasureSpec(width, layout.EXACTLY);
|
||||||
const heightSpec = layout.makeMeasureSpec(height, 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) {
|
public onLayout(left: number, top: number, right: number, bottom: number) {
|
||||||
|
if (this.hasActionBar) {
|
||||||
const { width: actionBarWidth, height: actionBarHeight } = this.actionBar._getActualSize;
|
const { width: actionBarWidth, height: actionBarHeight } = this.actionBar._getActualSize;
|
||||||
View.layoutChild(this, this.actionBar, 0, 0, actionBarWidth, actionBarHeight);
|
View.layoutChild(this, this.actionBar, 0, 0, actionBarWidth, actionBarHeight);
|
||||||
|
}
|
||||||
|
|
||||||
const insets = this.getSafeAreaInsets();
|
const insets = this.getSafeAreaInsets();
|
||||||
|
|
||||||
@ -486,7 +490,7 @@ export class Page extends PageBase {
|
|||||||
|
|
||||||
public _addViewToNativeVisualTree(child: View, atIndex: number): boolean {
|
public _addViewToNativeVisualTree(child: View, atIndex: number): boolean {
|
||||||
// ActionBar is handled by the UINavigationController
|
// ActionBar is handled by the UINavigationController
|
||||||
if (child === this.actionBar) {
|
if (this.hasActionBar && child === this.actionBar) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +522,7 @@ export class Page extends PageBase {
|
|||||||
|
|
||||||
public _removeViewFromNativeVisualTree(child: View): void {
|
public _removeViewFromNativeVisualTree(child: View): void {
|
||||||
// ActionBar is handled by the UINavigationController
|
// ActionBar is handled by the UINavigationController
|
||||||
if (child === this.actionBar) {
|
if (this.hasActionBar && child === this.actionBar) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user