diff --git a/src/app/components/scroller/scroller.ts b/src/app/components/scroller/scroller.ts index 602939b3ed1..884e069f664 100644 --- a/src/app/components/scroller/scroller.ts +++ b/src/app/components/scroller/scroller.ts @@ -554,12 +554,6 @@ export class Scroller implements OnInit, AfterContentInit, AfterViewChecked, OnD } } - if (simpleChanges.items) { - this.setSpacerSize(); - this.setSize(); - this.cd.detectChanges(); - } - if (this.initialized) { const isChanged = !isLoadingChanged && (simpleChanges.items?.previousValue?.length !== simpleChanges.items?.currentValue?.length || simpleChanges.itemSize || simpleChanges.scrollHeight || simpleChanges.scrollWidth); @@ -834,17 +828,18 @@ export class Scroller implements OnInit, AfterContentInit, AfterViewChecked, OnD contentHeight !== this.defaultContentHeight && ((this.elementViewChild).nativeElement.style.height = ''); const [width, height] = [DomHandler.getWidth((this.elementViewChild).nativeElement), DomHandler.getHeight((this.elementViewChild).nativeElement)]; - (this.both || this.horizontal) && ((this.elementViewChild).nativeElement.style.width = width < this.defaultWidth ? width + 'px' : this._scrollWidth || this.defaultWidth + 'px'); - (this.both || this.vertical) && ((this.elementViewChild).nativeElement.style.height = height < this.defaultHeight ? height + 'px' : this._scrollHeight || this.defaultHeight + 'px'); - + this.contentEl.style.minHeight = this.contentEl.style.minWidth = ''; this.contentEl.style.position = ''; (this.elementViewChild).nativeElement.style.contain = ''; - + this.defaultWidth = width; this.defaultHeight = height; this.defaultContentWidth = contentWidth; this.defaultContentHeight = contentHeight; + + (this.both || this.horizontal) && ((this.elementViewChild).nativeElement.style.width = width < this.defaultWidth ? width + 'px' : this._scrollWidth || this.defaultWidth + 'px'); + (this.both || this.vertical) && ((this.elementViewChild).nativeElement.style.height = height < this.defaultHeight ? height + 'px' : this._scrollHeight || this.defaultHeight + 'px'); } }); }