diff --git a/core/src/components/virtual-scroll/virtual-scroll.tsx b/core/src/components/virtual-scroll/virtual-scroll.tsx index 5c23242d57..bc1aae68e4 100644 --- a/core/src/components/virtual-scroll/virtual-scroll.tsx +++ b/core/src/components/virtual-scroll/virtual-scroll.tsx @@ -125,7 +125,6 @@ export class VirtualScroll { } contentEl.componentOnReady().then(() => { this.scrollEl = contentEl.getScrollElement(); - this.calcDimensions(); this.calcCells(); this.updateState(); }); @@ -147,7 +146,6 @@ export class VirtualScroll { @Listen('window:resize') onResize() { this.indexDirty = 0; - this.calcDimensions(); this.calcCells(); this.updateVirtualScroll(); } @@ -232,6 +230,7 @@ export class VirtualScroll { } this.viewportOffset = topOffset; if (scrollEl) { + this.viewportHeight = scrollEl.offsetHeight; this.currentScrollTop = scrollEl.scrollTop; } } @@ -313,8 +312,7 @@ export class VirtualScroll { private updateState() { const shouldEnable = !!( this.scrollEl && - this.cells && - this.viewportHeight > 1 + this.cells ); if (shouldEnable !== this.isEnabled) { this.enableScrollEvents(shouldEnable); @@ -360,12 +358,6 @@ export class VirtualScroll { this.indexDirty = Infinity; } - private calcDimensions() { - if (this.scrollEl) { - this.viewportHeight = this.scrollEl.offsetHeight; - } - } - private enableScrollEvents(shouldListen: boolean) { if (this.scrollEl) { this.isEnabled = shouldListen;