From 21200eab2151b4bbf47fcece95587ef61cb9ef78 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 21 Apr 2022 09:51:24 +0200 Subject: [PATCH] MOBILE-3833 swipe-slides: Fix slides width after resize --- src/core/components/swipe-slides/swipe-slides.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/components/swipe-slides/swipe-slides.ts b/src/core/components/swipe-slides/swipe-slides.ts index a169714e4..27e6587b3 100644 --- a/src/core/components/swipe-slides/swipe-slides.ts +++ b/src/core/components/swipe-slides/swipe-slides.ts @@ -18,6 +18,8 @@ import { import { CoreSwipeSlidesItemsManager } from '@classes/items-management/swipe-slides-items-manager'; import { IonContent, IonSlides } from '@ionic/angular'; import { CoreDomUtils, VerticalPoint } from '@services/utils/dom'; +import { CoreDom } from '@singletons/dom'; +import { CoreEventObserver } from '@singletons/events'; import { CoreMath } from '@singletons/math'; /** @@ -40,12 +42,17 @@ export class CoreSwipeSlidesComponent implements OnChanges, OnDe protected hostElement: HTMLElement; protected unsubscribe?: () => void; + protected resizeListener: CoreEventObserver; constructor( elementRef: ElementRef, protected content?: IonContent, ) { this.hostElement = elementRef.nativeElement; + + this.resizeListener = CoreDom.onWindowResize(() => { + this.slides?.update(); + }); } /** @@ -247,6 +254,7 @@ export class CoreSwipeSlidesComponent implements OnChanges, OnDe */ ngOnDestroy(): void { this.unsubscribe && this.unsubscribe(); + this.resizeListener.off(); } }