This repository was archived by the owner on May 4, 2022. It is now read-only.

Description
I'm submitting a ... (check one with "x")
[X] bug report
[ ] feature request
Current behavior:
Virtual Scroll stops updating the item position after crashing with TypeError: null is not an object (evaluating 'ev.scrollTop').
Expected behavior:
VirtualScroll scrollUpdate should verify if the event is null and not crash.
Steps to reproduce:
Have a scenario where multiple scrollTo might be callled.
Related code:
As far as I was able to debug it is caused by a null being emitted by the ScrollView in the setScrolling method. It happens because scrollTo starts the scroll loop when this.isScrolling still active with causes both isScrolling and is this.isScrolling to be true and a onScroll event to be emited with the null value, with causes VirtualScroll.scrollUpdate to crash when tries to access ev.scrollTop.
setScrolling(isScrolling: boolean, ev: ScrollEvent) {
if (this.isScrolling) {
if (isScrolling) {
this.onScroll && this.onScroll(ev);
} else {
this.isScrolling = false;
this.onScrollEnd && this.onScrollEnd(ev);
}
} else if (isScrolling) {
this.isScrolling = true;
this.onScrollStart && this.onScrollStart(ev);
}
}
scrollUpdate(ev: ScrollEvent) {
// set the scroll top from the scroll event
this._data.scrollTop = ev.scrollTop;
// there is a queue system so that we can
// spread out the work over multiple frames
const queue = this._queue;
if (queue === ScrollQueue.NoChanges) {
// no dom writes or change detection to take care of
this._stepNoChanges();
} else if (queue === ScrollQueue.ChangeDetection) {
this._dom.write(() => this._stepChangeDetection());
} else {
assert(queue === ScrollQueue.DomWrite, 'queue value unexpected');
// there are DOM writes we need to take care of in this frame
this._dom.write(() => this._stepDOMWrite());
}
}
Other information:
Ionic info:
ionic info
cli packages: (--REDACTED--)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.1.0
local packages:
@ionic/app-scripts : 3.2.0
Cordova Platforms : android 6.4.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v11.0.0
npm : 6.4.1
OS : Linux 4.18
Environment Variables:
ANDROID_HOME : /opt/android-sdk
Misc:
backend : pro