From dc7a638ae4b849b2f19db4138adf01f010539a4f Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 21 Nov 2016 13:40:18 -0600 Subject: [PATCH] refactor(overlay): remove default pageTransitionDelay on dismiss --- .../action-sheet/action-sheet-component.ts | 12 +++++------- src/components/alert/alert-component.ts | 13 +++++-------- src/components/picker/picker-component.ts | 10 ++++------ src/config/config.ts | 5 ++--- src/config/mode-registry.ts | 3 --- 5 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/components/action-sheet/action-sheet-component.ts b/src/components/action-sheet/action-sheet-component.ts index 8a463d1a60d..b5aa9ad2558 100644 --- a/src/components/action-sheet/action-sheet-component.ts +++ b/src/components/action-sheet/action-sheet-component.ts @@ -58,7 +58,7 @@ export class ActionSheetCmp { constructor( private _viewCtrl: ViewController, - private _config: Config, + config: Config, private _elementRef: ElementRef, gestureCtrl: GestureController, params: NavParams, @@ -66,7 +66,7 @@ export class ActionSheetCmp { ) { this.gestureBlocker = gestureCtrl.createBlocker(BLOCK_ALL); this.d = params.data; - this.mode = _config.get('mode'); + this.mode = config.get('mode'); renderer.setElementClass(_elementRef.nativeElement, `action-sheet-${this.mode}`, true); if (this.d.cssClass) { @@ -141,7 +141,7 @@ export class ActionSheetCmp { } } - click(button: any, dismissDelay?: number) { + click(button: any) { if (! this.enabled ) { return; } @@ -157,16 +157,14 @@ export class ActionSheetCmp { } if (shouldDismiss) { - setTimeout(() => { - this.dismiss(button.role); - }, dismissDelay || this._config.get('pageTransitionDelay')); + this.dismiss(button.role); } } bdClick() { if (this.enabled && this.d.enableBackdropDismiss) { if (this.d.cancelButton) { - this.click(this.d.cancelButton, 1); + this.click(this.d.cancelButton); } else { this.dismiss('backdrop'); diff --git a/src/components/alert/alert-component.ts b/src/components/alert/alert-component.ts index 48713baffb6..8e542e88a6e 100644 --- a/src/components/alert/alert-component.ts +++ b/src/components/alert/alert-component.ts @@ -94,7 +94,7 @@ export class AlertCmp { constructor( public _viewCtrl: ViewController, public _elementRef: ElementRef, - public _config: Config, + config: Config, gestureCtrl: GestureController, params: NavParams, private _renderer: Renderer, @@ -103,7 +103,7 @@ export class AlertCmp { // gesture blocker is used to disable gestures dynamically this.gestureBlocker = gestureCtrl.createBlocker(BLOCK_ALL); this.d = params.data; - this.mode = _config.get('mode'); + this.mode = config.get('mode'); _renderer.setElementClass(_elementRef.nativeElement, `alert-${this.mode}`, true); if (this.d.cssClass) { @@ -233,7 +233,7 @@ export class AlertCmp { } } - btnClick(button: any, dismissDelay?: number) { + btnClick(button: any) { if (!this.enabled) { return; } @@ -253,10 +253,7 @@ export class AlertCmp { } if (shouldDismiss) { - setTimeout(() => { - this.dismiss(button.role); - }, dismissDelay || this._config.get('pageTransitionDelay')); - + this.dismiss(button.role); focusOutActiveElement(); } } @@ -288,7 +285,7 @@ export class AlertCmp { if (this.enabled && this.d.enableBackdropDismiss) { let cancelBtn = this.d.buttons.find(b => b.role === 'cancel'); if (cancelBtn) { - this.btnClick(cancelBtn, 1); + this.btnClick(cancelBtn); } else { this.dismiss('backdrop'); diff --git a/src/components/picker/picker-component.ts b/src/components/picker/picker-component.ts index 30d277f5258..c42b4bc1a7a 100644 --- a/src/components/picker/picker-component.ts +++ b/src/components/picker/picker-component.ts @@ -461,14 +461,14 @@ export class PickerCmp { constructor( private _viewCtrl: ViewController, private _elementRef: ElementRef, - private _config: Config, + config: Config, gestureCtrl: GestureController, params: NavParams, renderer: Renderer ) { this._gestureBlocker = gestureCtrl.createBlocker(BLOCK_ALL); this.d = params.data; - this.mode = _config.get('mode'); + this.mode = config.get('mode'); renderer.setElementClass(_elementRef.nativeElement, `picker-${this.mode}`, true); if (this.d.cssClass) { @@ -579,7 +579,7 @@ export class PickerCmp { this.enabled = true; } - btnClick(button: any, dismissDelay?: number) { + btnClick(button: any) { if (!this.enabled) { return; } @@ -599,9 +599,7 @@ export class PickerCmp { } if (shouldDismiss) { - setTimeout(() => { - this.dismiss(button.role); - }, dismissDelay || this._config.get('pageTransitionDelay')); + this.dismiss(button.role); } } diff --git a/src/config/config.ts b/src/config/config.ts index 514a187aefc..49cd66e634d 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -108,15 +108,14 @@ import { isObject, isDefined, isFunction, isArray } from '../util/util'; * | `menuType` | `string` | Type of menu to display. Available options: `"overlay"`, `"reveal"`, `"push"`. | * | `modalEnter` | `string` | The name of the transition to use while a modal is presented. | * | `modalLeave` | `string` | The name of the transition to use while a modal is dismiss. | - * | `mode` | `string` | The mode to use throughout the application. | + * | `mode` | `string` | The mode to use throughout the application. | * | `pageTransition` | `string` | The name of the transition to use while changing pages. | - * | `pageTransitionDelay` | `number` | The delay in milliseconds before the transition starts while changing pages. | * | `pickerEnter` | `string` | The name of the transition to use while a picker is presented. | * | `pickerLeave` | `string` | The name of the transition to use while a picker is dismissed. | * | `popoverEnter` | `string` | The name of the transition to use while a popover is presented. | * | `popoverLeave` | `string` | The name of the transition to use while a popover is dismissed. | * | `spinner` | `string` | The default spinner to use when a name is not defined. | - * | `swipeBackEnabled` | `boolean` | Whether native iOS swipe to go back functionality is enabled. + * | `swipeBackEnabled` | `boolean` | Whether native iOS swipe to go back functionality is enabled. | * | `tabsHighlight` | `boolean` | Whether to show a highlight line under the tab when it is selected. | * | `tabsLayout` | `string` | The layout to use for all tabs. Available options: `"icon-top"`, `"icon-left"`, `"icon-right"`, `"icon-bottom"`, `"icon-hide"`, `"title-hide"`. | * | `tabsPlacement` | `string` | The position of the tabs relative to the content. Available options: `"top"`, `"bottom"` | diff --git a/src/config/mode-registry.ts b/src/config/mode-registry.ts index 2bce29f4f25..38937f8171b 100644 --- a/src/config/mode-registry.ts +++ b/src/config/mode-registry.ts @@ -24,7 +24,6 @@ export const MODE_IOS: any = { modalLeave: 'modal-slide-out', pageTransition: 'ios-transition', - pageTransitionDelay: 16, pickerEnter: 'picker-slide-in', pickerLeave: 'picker-slide-out', @@ -68,7 +67,6 @@ export const MODE_MD: any = { modalLeave: 'modal-md-slide-out', pageTransition: 'md-transition', - pageTransitionDelay: 64, pickerEnter: 'picker-slide-in', pickerLeave: 'picker-slide-out', @@ -112,7 +110,6 @@ export const MODE_WP: any = { modalLeave: 'modal-md-slide-out', pageTransition: 'wp-transition', - pageTransitionDelay: 96, pickerEnter: 'picker-slide-in', pickerLeave: 'picker-slide-out',