MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / onWindowResize

Method onWindowResize

core/src/components/modal/modal.tsx:292–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

290
291 @Listen('resize', { target: 'window' })
292 onWindowResize() {
293 if (!this.presented) return;
294
295 clearTimeout(this.resizeTimeout);
296 this.resizeTimeout = setTimeout(() => {
297 const context = this.getSafeAreaContext();
298
299 // iOS card modals: handle portrait/landscape view transitions
300 if (context.isCardModal && !this.enterAnimation && !this.leaveAnimation) {
301 this.handleViewTransition();
302 }
303
304 // Sheet modals: re-compute the internal offset property since safe-area
305 // values may change on device rotation (e.g., portrait notch vs landscape).
306 if (context.isSheetModal) {
307 this.updateSheetOffsetTop();
308 }
309
310 // Regular (non-sheet, non-card) modals: update safe-area overrides
311 // since the viewport may have crossed the centered-dialog breakpoint.
312 if (!context.isSheetModal && !context.isCardModal) {
313 this.updateSafeAreaOverrides();
314
315 // Re-evaluate fullscreen safe-area padding: clear first, then re-apply.
316 const { contentEl, hasFooter } = this.findContentAndFooter();
317 this.clearContentSafeAreaPadding(contentEl);
318 this.applyFullscreenSafeAreaTo(contentEl, hasFooter);
319 }
320 }, 50); // Debounce to avoid excessive calls during active resizing
321 }
322
323 /**
324 * If `true`, the component passed into `ion-modal` will

Callers

nothing calls this directly

Calls 7

getSafeAreaContextMethod · 0.95
handleViewTransitionMethod · 0.95
updateSheetOffsetTopMethod · 0.95
findContentAndFooterMethod · 0.95

Tested by

no test coverage detected