From f7f12e5f38fc2b47e5074210d51dee732db6ac92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ka=CC=88slin?= Date: Fri, 30 Sep 2016 13:29:33 +0200 Subject: [PATCH] this.approxItemHeight is undefined when update(true) is called first, see https://github.com/driftyco/ionic/issues/8311 --- src/components/virtual-scroll/virtual-scroll.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/virtual-scroll/virtual-scroll.ts b/src/components/virtual-scroll/virtual-scroll.ts index 9248c3dde87..034f228bb7e 100644 --- a/src/components/virtual-scroll/virtual-scroll.ts +++ b/src/components/virtual-scroll/virtual-scroll.ts @@ -343,6 +343,11 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy { this._init = true; + if (!this.approxItemHeight) { + this.approxItemHeight = '40px'; + console.warn('Virtual Scroll: Please provide an "approxItemHeight" input to ensure proper virtual scroll rendering'); + } + this.update(true); this._platform.onResize(() => { @@ -350,10 +355,6 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy { this.update(false); }); - if (!this.approxItemHeight) { - this.approxItemHeight = '40px'; - console.warn('Virtual Scroll: Please provide an "approxItemHeight" input to ensure proper virtual scroll rendering'); - } } }