Skip to content

Commit

Permalink
refactor(overlay): remove default pageTransitionDelay on dismiss
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Nov 21, 2016
1 parent 8504716 commit dc7a638
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 27 deletions.
12 changes: 5 additions & 7 deletions src/components/action-sheet/action-sheet-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ export class ActionSheetCmp {

constructor(
private _viewCtrl: ViewController,
private _config: Config,
config: Config,
private _elementRef: ElementRef,
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, `action-sheet-${this.mode}`, true);

if (this.d.cssClass) {
Expand Down Expand Up @@ -141,7 +141,7 @@ export class ActionSheetCmp {
}
}

click(button: any, dismissDelay?: number) {
click(button: any) {
if (! this.enabled ) {
return;
}
Expand All @@ -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');
Expand Down
13 changes: 5 additions & 8 deletions src/components/alert/alert-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down Expand Up @@ -233,7 +233,7 @@ export class AlertCmp {
}
}

btnClick(button: any, dismissDelay?: number) {
btnClick(button: any) {
if (!this.enabled) {
return;
}
Expand All @@ -253,10 +253,7 @@ export class AlertCmp {
}

if (shouldDismiss) {
setTimeout(() => {
this.dismiss(button.role);
}, dismissDelay || this._config.get('pageTransitionDelay'));

this.dismiss(button.role);
focusOutActiveElement();
}
}
Expand Down Expand Up @@ -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');
Expand Down
10 changes: 4 additions & 6 deletions src/components/picker/picker-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -579,7 +579,7 @@ export class PickerCmp {
this.enabled = true;
}

btnClick(button: any, dismissDelay?: number) {
btnClick(button: any) {
if (!this.enabled) {
return;
}
Expand All @@ -599,9 +599,7 @@ export class PickerCmp {
}

if (shouldDismiss) {
setTimeout(() => {
this.dismiss(button.role);
}, dismissDelay || this._config.get('pageTransitionDelay'));
this.dismiss(button.role);
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"` |
Expand Down
3 changes: 0 additions & 3 deletions src/config/mode-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit dc7a638

Please sign in to comment.