Skip to content

Commit 4ad27fb

Browse files
committed
fix(modal): fix recalculating isSheetModal for Angular
1 parent 38743ff commit 4ad27fb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/src/components/modal/modal.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
7171
private gesture?: Gesture;
7272
private coreDelegate: FrameworkDelegate = CoreDelegate();
7373
private sheetTransition?: Promise<any>;
74-
private isSheetModal = false;
74+
@State() private isSheetModal = false;
7575
private currentBreakpoint?: number;
7676
private wrapperEl?: HTMLElement;
7777
private backdropEl?: HTMLIonBackdropElement;
@@ -644,7 +644,14 @@ export class Modal implements ComponentInterface, OverlayInterface {
644644
window.addEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
645645
}
646646

647-
if (this.isSheetModal) {
647+
/**
648+
* Recalculate isSheetModal because framework bindings (e.g., Angular)
649+
* may not have been applied when componentWillLoad ran.
650+
*/
651+
const isSheetModal = this.breakpoints !== undefined && this.initialBreakpoint !== undefined;
652+
this.isSheetModal = isSheetModal;
653+
654+
if (isSheetModal) {
648655
this.initSheetGesture();
649656
} else if (hasCardModal) {
650657
this.initSwipeToClose();

0 commit comments

Comments
 (0)