From 841ed7363c15d7745b2e000a45ed9cf174b38474 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 20 May 2015 11:23:20 -0500 Subject: [PATCH] the adventures of iOS toolbar --- ionic/components/content/extensions/ios.scss | 7 ++++++- ionic/components/toolbar/extensions/ios.scss | 6 +++--- ionic/components/toolbar/toolbar.js | 9 +++++++-- ionic/transitions/ios-transition.js | 11 +++++------ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ionic/components/content/extensions/ios.scss b/ionic/components/content/extensions/ios.scss index 1b0feef351..eff09fa4c1 100644 --- a/ionic/components/content/extensions/ios.scss +++ b/ionic/components/content/extensions/ios.scss @@ -2,9 +2,14 @@ // iOS Content // -------------------------------------------------- -$content-ios-background-color: #efeff4 !default; +$nav-container-ios-background-color: #000 !default; +$content-ios-background-color: #efeff4 !default; +.platform-ios .nav-item-container { + background-color: $nav-container-ios-background-color; +} + .platform-ios ion-content { background-color: $content-ios-background-color; } diff --git a/ionic/components/toolbar/extensions/ios.scss b/ionic/components/toolbar/extensions/ios.scss index de521ddcb3..01be2ca2e9 100644 --- a/ionic/components/toolbar/extensions/ios.scss +++ b/ionic/components/toolbar/extensions/ios.scss @@ -66,8 +66,8 @@ $toolbar-ios-button-background-color: transparent !default; background: $toolbar-ios-button-background-color; } -} + .back-button-icon { + padding-right: 6px; + } -.back-button-ios .back-button-icon { - padding-right: 6px; } diff --git a/ionic/components/toolbar/toolbar.js b/ionic/components/toolbar/toolbar.js index c0a4d6287b..7427ae4e25 100644 --- a/ionic/components/toolbar/toolbar.js +++ b/ionic/components/toolbar/toolbar.js @@ -47,8 +47,6 @@ export class Toolbar { } alignTitle() { - if (!this.domElement) return; - const toolbarEle = this.domElement; const innerTitleEle = this._innerTitleEle || (this._innerTitleEle = toolbarEle.querySelector('.toolbar-inner-title')); const titleEle = this._titleEle || (this._titleEle = innerTitleEle.querySelector('ion-title')); @@ -59,6 +57,13 @@ export class Toolbar { const titleScrollWidth = titleEle.scrollWidth; const toolbarOffsetWidth = toolbarEle.offsetWidth; + // TODO!!! When an element is being reused by angular2, it'll sometimes keep the + // styles from the original element's use, causing these calculations to be wrong + if (window.getComputedStyle(innerTitleEle).margin !== '0px') { + this._showTitle(); + return; + } + // only align if the title is center and if it isn't already overflowing if (style.textAlign !== 'center' || titleOffsetWidth < titleScrollWidth) { this._showTitle(); diff --git a/ionic/transitions/ios-transition.js b/ionic/transitions/ios-transition.js index 538ef6f656..c1db088f85 100644 --- a/ionic/transitions/ios-transition.js +++ b/ionic/transitions/ios-transition.js @@ -59,8 +59,9 @@ class IOSTransition extends Animation { .to(OPACITY, 1); enteringTitle - .to(TRANSFORM, CENTER) - .to(OPACITY, 1); + .from(OPACITY, 0) + .to(OPACITY, 1) + .to(TRANSFORM, CENTER); enteringToolbars .beforePlay.addClass(SHOW_TOOLBAR_CSS); @@ -101,9 +102,7 @@ class IOSTransition extends Animation { .to(OPACITY, 1); enteringTitle - .from(TRANSFORM, OFF_LEFT) - .from(OPACITY, 0) - .to(OPACITY, 1); + .from(TRANSFORM, OFF_LEFT); leavingContent .to(TRANSFORM, OFF_RIGHT) @@ -111,7 +110,7 @@ class IOSTransition extends Animation { leavingTitle .to(TRANSFORM, OFF_RIGHT) - .to(OPACITY, 1); + .to(OPACITY, 0); } else { // forward direction