Skip to content

Commit

Permalink
fix(modal/popover): lifecycle events
Browse files Browse the repository at this point in the history
fixes #15806
  • Loading branch information
manucorporat committed Oct 8, 2018
1 parent 11aa241 commit 19c449e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,6 @@ export class Modal implements ComponentInterface, OverlayInterface {
const LIFECYCLE_MAP: any = {
'ionModalDidPresent': 'ionViewDidEnter',
'ionModalWillPresent': 'ionViewWillEnter',
'ionModalWillDismiss': 'ionViewWillDismiss',
'ionModalDidDismiss': 'ionViewDidDismiss',
'ionModalWillDismiss': 'ionViewWillLeave',
'ionModalDidDismiss': 'ionViewDidLeave',
};
4 changes: 2 additions & 2 deletions core/src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,6 @@ export class Popover implements ComponentInterface, OverlayInterface {
const LIFECYCLE_MAP: any = {
'ionPopoverDidPresent': 'ionViewDidEnter',
'ionPopoverWillPresent': 'ionViewWillEnter',
'ionPopoverWillDismiss': 'ionViewWillDismiss',
'ionPopoverDidDismiss': 'ionViewDidDismiss',
'ionPopoverWillDismiss': 'ionViewWillLeave',
'ionPopoverDidDismiss': 'ionViewDidLeave',
};
7 changes: 4 additions & 3 deletions core/src/utils/overlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AnimationBuilder, BackButtonEvent, HTMLIonOverlayElement, IonicConfig,
let lastId = 0;

export function createOverlay<T extends HTMLIonOverlayElement>(element: T, opts: object | undefined): Promise<T> {
const doc = element.ownerDocument;
const doc = element.ownerDocument!;
connectListeners(doc);

// convert the passed in overlay options into props
Expand Down Expand Up @@ -152,16 +152,17 @@ async function overlayAnimation(
}
if (overlay.keyboardClose) {
animation.beforeAddWrite(() => {
const activeElement = baseEl.ownerDocument.activeElement as HTMLElement;
const activeElement = baseEl.ownerDocument!.activeElement as HTMLElement;
if (activeElement && activeElement.matches('input, ion-input, ion-textarea')) {
activeElement.blur();
}
});
}
await animation.playAsync();
const hasCompleted = animation.hasCompleted;
animation.destroy();
overlay.animation = undefined;
return animation.hasCompleted;
return hasCompleted;
}
}

Expand Down

0 comments on commit 19c449e

Please sign in to comment.