Skip to content

Commit

Permalink
fix(menu): behaves like main content
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Oct 5, 2016
1 parent 63c6d46 commit be58492
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/components/content/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,9 @@ export class Content extends Ion {
this._tabsPlacement = null;

let ele: HTMLElement = this._elementRef.nativeElement;
if (!ele) return;
if (!ele) {
return;
}

let parentEle: HTMLElement = ele.parentElement;
let computedStyle: any;
Expand Down
6 changes: 2 additions & 4 deletions src/components/menu/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ ion-menu.show-menu {
bottom: 0;
left: 0;

display: flex;

flex-direction: column;
display: block;

width: $menu-width;

Expand All @@ -41,7 +39,7 @@ ion-menu.show-menu {
.menu-inner > ion-header,
.menu-inner > ion-content,
.menu-inner > ion-footer {
position: relative;
position: absolute;
}

ion-menu[side=right] > .menu-inner {
Expand Down
9 changes: 7 additions & 2 deletions src/components/menu/menu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, NgZone, Output, Renderer, ViewChild, ViewEncapsulation } from '@angular/core';
import { ChangeDetectionStrategy, Component, ContentChild, ElementRef, EventEmitter, Input, NgZone, Output, Renderer, ViewChild, ViewEncapsulation } from '@angular/core';

import { Backdrop } from '../backdrop/backdrop';
import { Config } from '../../config/config';
Expand All @@ -10,7 +10,7 @@ import { MenuType } from './menu-types';
import { Platform } from '../../platform/platform';
import { GestureController } from '../../gestures/gesture-controller';
import { UIEventManager } from '../../util/ui-event-manager';

import { Content } from '../content/content';

/**
* @name Menu
Expand Down Expand Up @@ -208,6 +208,10 @@ export class Menu {
*/
@ViewChild(Backdrop) backdrop: Backdrop;

/**
* @private
*/
@ContentChild(Content) menuContent: Content;
/**
* @input {any} A reference to the content element the menu should use.
*/
Expand Down Expand Up @@ -471,6 +475,7 @@ export class Menu {
this.getNativeElement().classList.add('show-menu');
this.getBackdropElement().classList.add('show-backdrop');
this._keyboard.close();
this.menuContent && this.menuContent.resize();
this._isAnimating = true;
}

Expand Down
6 changes: 1 addition & 5 deletions src/components/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Content } from '../content/content';
import { DeepLinker } from '../../navigation/deep-linker';
import { Ion } from '../ion';
import { isBlank } from '../../util/util';
import { nativeRaf } from '../../util/dom';
import { NavController } from '../../navigation/nav-controller';
import { NavControllerBase } from '../../navigation/nav-controller-base';
import { NavOptions, DIRECTION_SWITCH } from '../../navigation/nav-util';
Expand Down Expand Up @@ -472,10 +471,7 @@ export class Tabs extends Ion implements AfterViewInit {
if (alreadyLoaded && selectedPage) {
let content = <Content>selectedPage.getContent();
if (content && content instanceof Content) {
nativeRaf(() => {
content.readDimensions();
content.writeDimensions();
});
content.resize();
}
}
});
Expand Down
1 change: 1 addition & 0 deletions src/transitions/page-transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class PageTransition extends Transition {
this.enteringPage = new Animation(this.enteringView.pageRef());
this.add(this.enteringPage.beforeAddClass('show-page'));

// Resize content before transition starts
this.beforeAddRead(this.readDimensions.bind(this));
this.beforeAddWrite(this.writeDimensions.bind(this));
}
Expand Down

0 comments on commit be58492

Please sign in to comment.