From da986a5fb0ee2c7660ad4494731b5fe98b393812 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 1 Jan 2016 21:56:40 -0600 Subject: [PATCH] feat(transition): pass isRTL in transition opts --- ionic/components/nav/nav-controller.ts | 3 +++ ionic/config/bootstrap.ts | 4 ++-- ionic/config/config.ts | 10 +++++----- ionic/platform/platform.ts | 8 ++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ionic/components/nav/nav-controller.ts b/ionic/components/nav/nav-controller.ts index 5f46ecf174..61fa789f92 100644 --- a/ionic/components/nav/nav-controller.ts +++ b/ionic/components/nav/nav-controller.ts @@ -794,6 +794,9 @@ export class NavController extends Ion { // init the transition animation opts.renderDelay = opts.transitionDelay || self._trnsDelay; + // set if this app is right-to-left or not + opts.isRTL = this.config.platform.isRTL(); + let transAnimation = Animation.createTransition(enteringView, leavingView, opts); diff --git a/ionic/config/bootstrap.ts b/ionic/config/bootstrap.ts index facc2da052..35b85d828a 100644 --- a/ionic/config/bootstrap.ts +++ b/ionic/config/bootstrap.ts @@ -91,8 +91,8 @@ function setupDom(window, document, config, platform, clickBlock, featureDetect) bodyEle.classList.add(mode); // right-to-left language direction - platform.setDir(document.dir); - if (platform.isRTL()) { + if (document.dir === 'rtl') { + platform.setIsRTL(true); bodyEle.classList.add('rtl'); } diff --git a/ionic/config/config.ts b/ionic/config/config.ts index af2ab3b8b7..ac1991c557 100644 --- a/ionic/config/config.ts +++ b/ionic/config/config.ts @@ -200,8 +200,8 @@ export class Config { let platformModeValue = undefined; let configObj = null; - if (this._platform) { - let queryStringValue = this._platform.query('ionic' + key.toLowerCase()); + if (this.platform) { + let queryStringValue = this.platform.query('ionic' + key.toLowerCase()); if (isDefined(queryStringValue)) { return this._c[key] = (queryStringValue === 'true' ? true : queryStringValue === 'false' ? false : queryStringValue); } @@ -211,7 +211,7 @@ export class Config { // array of active platforms, which also knows the hierarchy, // with the last one the most important - let activePlatformKeys = this._platform.platforms(); + let activePlatformKeys = this.platform.platforms(); // loop through all of the active platforms we're on for (let i = 0, l = activePlatformKeys.length; i < l; i++) { @@ -272,7 +272,7 @@ export class Config { // or it was from the default platform configs // in that order if (isFunction(this._c[key])) { - return this._c[key](this._platform); + return this._c[key](this.platform); } return this._c[key]; @@ -282,7 +282,7 @@ export class Config { * @private */ setPlatform(platform) { - this._platform = platform; + this.platform = platform; } static setModeConfig(mode, config) { diff --git a/ionic/platform/platform.ts b/ionic/platform/platform.ts index 257dab85f7..4e2d447418 100644 --- a/ionic/platform/platform.ts +++ b/ionic/platform/platform.ts @@ -26,7 +26,7 @@ export class Platform { constructor(platforms=[]) { this._platforms = platforms; this._versions = {}; - this._dir = 'ltr'; + this._isRTL = false; this._onResizes = []; this._readyPromise = new Promise(res => { this._readyResolve = res; } ); @@ -173,14 +173,14 @@ export class Platform { * @returns {boolean} */ isRTL() { - return (this._dir === 'rtl'); + return this._isRTL; } /** * @private */ - setDir(dir) { - this._dir = dir.toLowerCase(); + setIsRTL(val) { + this._isRTL = val; } // Methods meant to be overridden by the engine