fix(refresher): resolve undefined issues when updating component (#20322)

fixes #20320
This commit is contained in:
Liam DeBeasi
2020-01-28 14:59:58 -05:00
committed by GitHub
parent f1e3e42f75
commit 59d86873a2

View File

@ -124,10 +124,11 @@ export class Refresher implements ComponentInterface {
@Event() ionStart!: EventEmitter<void>;
private checkNativeRefresher() {
if (shouldUseNativeRefresher(this.el, getIonMode(this))) {
const useNativeRefresher = shouldUseNativeRefresher(this.el, getIonMode(this));
if (useNativeRefresher && !this.nativeRefresher) {
const contentEl = this.el.closest('ion-content');
this.setupNativeRefresher(contentEl);
} else {
} else if (!useNativeRefresher) {
this.destroyNativeRefresher();
}
}
@ -360,7 +361,7 @@ export class Refresher implements ComponentInterface {
}
private async setupNativeRefresher(contentEl: HTMLIonContentElement | null) {
if (this.scrollListenerCallback || !contentEl || this.nativeRefresher) {
if (this.scrollListenerCallback || !contentEl || this.nativeRefresher || !this.scrollEl) {
return;
}