From 39e1dce72d284ac03ccdbdb1c49cf7d103c8fca1 Mon Sep 17 00:00:00 2001
From: Adam Bradley
Date: Wed, 7 Dec 2016 15:59:20 -0600
Subject: [PATCH] fix(img): ensure scroll has been initialized
---
src/components/content/content.ts | 2 +-
src/components/tabs/test/basic/app-module.ts | 2 +-
src/components/virtual-scroll/test/cards/main.html | 6 +++---
src/util/scroll-view.ts | 5 ++++-
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/components/content/content.ts b/src/components/content/content.ts
index d44135736ff..94173f90bde 100644
--- a/src/components/content/content.ts
+++ b/src/components/content/content.ts
@@ -777,7 +777,7 @@ export class Content extends Ion implements OnDestroy, OnInit {
* @private
*/
imgsUpdate() {
- if (this._imgs.length && this.isImgsUpdatable()) {
+ if (this._scroll.initialized && this._imgs.length && this.isImgsUpdatable()) {
updateImgs(this._imgs, this.scrollTop, this.scrollHeight, this.directionY, IMG_REQUESTABLE_BUFFER, IMG_RENDERABLE_BUFFER);
}
}
diff --git a/src/components/tabs/test/basic/app-module.ts b/src/components/tabs/test/basic/app-module.ts
index 4c1ddd97732..60655422174 100644
--- a/src/components/tabs/test/basic/app-module.ts
+++ b/src/components/tabs/test/basic/app-module.ts
@@ -187,7 +187,7 @@ export class Tab2 {
-
+
Item: {{item}}
diff --git a/src/components/virtual-scroll/test/cards/main.html b/src/components/virtual-scroll/test/cards/main.html
index 074cd52c9b5..27e43d56dcd 100644
--- a/src/components/virtual-scroll/test/cards/main.html
+++ b/src/components/virtual-scroll/test/cards/main.html
@@ -8,15 +8,15 @@
-
+
-
+
-
+
{{ item.name }}
diff --git a/src/util/scroll-view.ts b/src/util/scroll-view.ts
index 0b61ce1dd3d..75489dec4a9 100644
--- a/src/util/scroll-view.ts
+++ b/src/util/scroll-view.ts
@@ -11,6 +11,7 @@ export class ScrollView {
scrollStart = new Subject();
scroll = new Subject();
scrollEnd = new Subject();
+ initialized: boolean;
private _el: HTMLElement;
private _js: boolean;
@@ -28,7 +29,9 @@ export class ScrollView {
constructor(private _dom: DomController) {}
init(ele: HTMLElement, contentTop: number, contentBottom: number) {
- if (!this._el) {
+ if (!this.initialized) {
+ this.initialized = true;
+
assert(ele, 'scroll-view, element can not be null');
this._el = ele;