mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
fix(tabs): hide tab's navbar when a page comes without a navbar
Closes #5556
This commit is contained in:
@ -125,11 +125,6 @@ ion-page.show-page scroll-content {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
ion-page.tab-subpage {
|
|
||||||
position: fixed;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Toolbar Container Structure
|
// Toolbar Container Structure
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -420,6 +420,7 @@ export class Content extends Ion {
|
|||||||
this._paddingBottom = 0;
|
this._paddingBottom = 0;
|
||||||
this._headerHeight = 0;
|
this._headerHeight = 0;
|
||||||
this._footerHeight = 0;
|
this._footerHeight = 0;
|
||||||
|
this._tabbarOnTop = null;
|
||||||
|
|
||||||
let ele: HTMLElement = this._elementRef.nativeElement;
|
let ele: HTMLElement = this._elementRef.nativeElement;
|
||||||
let parentEle: HTMLElement = ele.parentElement;
|
let parentEle: HTMLElement = ele.parentElement;
|
||||||
|
@ -247,12 +247,12 @@ export class Tab extends NavController {
|
|||||||
load(opts: NavOptions, done?: Function) {
|
load(opts: NavOptions, done?: Function) {
|
||||||
if (!this._loaded && this.root) {
|
if (!this._loaded && this.root) {
|
||||||
this.push(this.root, this.rootParams, opts).then(() => {
|
this.push(this.root, this.rootParams, opts).then(() => {
|
||||||
done();
|
done(true);
|
||||||
});
|
});
|
||||||
this._loaded = true;
|
this._loaded = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
done();
|
done(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,10 @@ import {Component, ElementRef, Optional, ViewChild, ViewContainerRef, EventEmitt
|
|||||||
|
|
||||||
import {App} from '../app/app';
|
import {App} from '../app/app';
|
||||||
import {Config} from '../../config/config';
|
import {Config} from '../../config/config';
|
||||||
|
import {Content} from '../content/content';
|
||||||
import {Ion} from '../ion';
|
import {Ion} from '../ion';
|
||||||
import {isBlank, isTrueProperty} from '../../util/util';
|
import {isBlank, isTrueProperty} from '../../util/util';
|
||||||
|
import {nativeRaf} from '../../util/dom';
|
||||||
import {NavController} from '../nav/nav-controller';
|
import {NavController} from '../nav/nav-controller';
|
||||||
import {Platform} from '../../platform/platform';
|
import {Platform} from '../../platform/platform';
|
||||||
import {Tab} from './tab';
|
import {Tab} from './tab';
|
||||||
@ -355,7 +357,7 @@ export class Tabs extends Ion {
|
|||||||
let selectedPage = selectedTab.getActive();
|
let selectedPage = selectedTab.getActive();
|
||||||
selectedPage && selectedPage.fireWillEnter();
|
selectedPage && selectedPage.fireWillEnter();
|
||||||
|
|
||||||
selectedTab.load(opts, () => {
|
selectedTab.load(opts, (initialLoad: boolean) => {
|
||||||
|
|
||||||
selectedTab.ionSelect.emit(selectedTab);
|
selectedTab.ionSelect.emit(selectedTab);
|
||||||
this.ionChange.emit(selectedTab);
|
this.ionChange.emit(selectedTab);
|
||||||
@ -388,6 +390,18 @@ export class Tabs extends Ion {
|
|||||||
this.selectHistory.push(selectedTab.id);
|
this.selectHistory.push(selectedTab.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if this is not the Tab's initial load then we need
|
||||||
|
// to refresh the tabbar and content dimensions to be sure
|
||||||
|
// they're lined up correctly
|
||||||
|
if (!initialLoad && selectedPage) {
|
||||||
|
var content = <Content>selectedPage.getContent();
|
||||||
|
if (content && content instanceof Content) {
|
||||||
|
nativeRaf(() => {
|
||||||
|
content.readDimensions();
|
||||||
|
content.writeDimensions();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,6 +515,7 @@ export class Tabs extends Ion {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
* DOM WRITE
|
||||||
*/
|
*/
|
||||||
setTabbarPosition(top: number, bottom: number) {
|
setTabbarPosition(top: number, bottom: number) {
|
||||||
let tabbarEle = <HTMLElement>this._tabbar.nativeElement;
|
let tabbarEle = <HTMLElement>this._tabbar.nativeElement;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
|
|
||||||
<p><button (click)="push()">Go to Tab 2, Page 3</button></p>
|
<p><button (click)="push()">Go to Tab 2, Page 3 (no navbar)</button></p>
|
||||||
<p><button (click)="nav.pop()">Back to Tab 2, Page 1</button></p>
|
<p><button (click)="nav.pop()">Back to Tab 2, Page 1</button></p>
|
||||||
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
||||||
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
<ion-header>
|
|
||||||
|
|
||||||
<ion-navbar>
|
|
||||||
<ion-title>Tabs 2, Page 3</ion-title>
|
|
||||||
</ion-navbar>
|
|
||||||
|
|
||||||
</ion-header>
|
|
||||||
|
|
||||||
|
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
|
|
||||||
|
<h2>Tab 2, Page 3</h2>
|
||||||
|
|
||||||
|
<p>No Header.</p>
|
||||||
|
|
||||||
<p><button (click)="nav.pop()">Back to Tab 2, Page 2</button></p>
|
<p><button (click)="nav.pop()">Back to Tab 2, Page 2</button></p>
|
||||||
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
||||||
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
<ion-header>
|
|
||||||
|
|
||||||
<ion-navbar>
|
|
||||||
<ion-title>Tabs 3, Page 1</ion-title>
|
|
||||||
</ion-navbar>
|
|
||||||
|
|
||||||
</ion-header>
|
|
||||||
|
|
||||||
|
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
|
|
||||||
<h2>Tabs 3, Page 1</h2>
|
<h2>Tabs 3, Page 1</h2>
|
||||||
|
|
||||||
|
<p>No header.</p>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
Reference in New Issue
Block a user