fix(router-outlet): css and change logic

This commit is contained in:
Manu Mtz.-Almeida
2018-03-21 16:50:54 +01:00
parent a98c764541
commit 6e683c54e0
6 changed files with 19 additions and 33 deletions

View File

@ -154,15 +154,16 @@ sub {
// -------------------------------------------------- // --------------------------------------------------
ion-app, ion-app,
ion-router-outlet,
ion-tab,
ion-tabs,
ion-nav,
.ion-page { .ion-page {
@include position(0); @include position(0);
position: absolute; position: absolute;
z-index: $z-index-page-container; z-index: $z-index-page-container;
display: flex; overflow: hidden;
flex-direction: column;
justify-content: space-between;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -170,6 +171,14 @@ ion-app,
contain: layout size style; contain: layout size style;
} }
ion-app,
.ion-page {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.hide-page { .hide-page {
opacity: 0; opacity: 0;
} }

View File

@ -1,14 +0,0 @@
@import "../../themes/util";
ion-nav {
@include position(0);
position: absolute;
z-index: $z-index-page-container;
overflow: hidden;
width: 100%;
height: 100%;
contain: layout size style;
}

View File

@ -22,7 +22,6 @@ import mdTransitionAnimation from './animations/md.transition';
@Component({ @Component({
tag: 'ion-nav', tag: 'ion-nav',
styleUrl: 'nav.scss'
}) })
export class NavControllerBase implements NavOutlet { export class NavControllerBase implements NavOutlet {

View File

@ -15,6 +15,7 @@ export class RouterOutlet implements NavOutlet {
private isTransitioning = false; private isTransitioning = false;
private activeEl: HTMLElement = undefined; private activeEl: HTMLElement = undefined;
private activeComponent: any;
mode: string; mode: string;
@ -28,14 +29,16 @@ export class RouterOutlet implements NavOutlet {
@Prop() delegate: FrameworkDelegate; @Prop() delegate: FrameworkDelegate;
componentDidUnload() { componentDidUnload() {
this.activeEl = undefined; this.activeEl = this.activeComponent = undefined;
} }
@Method() @Method()
async setRoot(component: HTMLElement|string, params?: {[key: string]: any}, opts?: RouterOutletOptions): Promise<boolean> { async setRoot(component: HTMLElement|string, params?: {[key: string]: any}, opts?: RouterOutletOptions): Promise<boolean> {
if (this.isTransitioning) { if (this.isTransitioning || this.activeComponent === component) {
return false; return false;
} }
this.activeComponent = component;
// attach entering view to DOM // attach entering view to DOM
const enteringEl = await attachComponent(this.delegate, this.el, component, ['ion-page', 'hide-page'], params); const enteringEl = await attachComponent(this.delegate, this.el, component, ['ion-page', 'hide-page'], params);
const leavingEl = this.activeEl; const leavingEl = this.activeEl;

View File

@ -1,10 +0,0 @@
@import "../../themes/ionic.globals";
ion-tab {
@include position(0, null, null, 0);
position: absolute;
width: 100%;
height: 100%;
}

View File

@ -1,8 +1,7 @@
import { Build, Component, Element, Event, EventEmitter, Method, Prop, State, Watch } from '@stencil/core'; import { Build, Component, Element, Event, EventEmitter, Method, Prop, State, Watch } from '@stencil/core';
@Component({ @Component({
tag: 'ion-tab', tag: 'ion-tab'
styleUrl: 'tab.scss'
}) })
export class Tab { export class Tab {