fix(refresher): quickly swiping down no longer causes duplicate refresh (#25476)

resolves #25418
This commit is contained in:
Liam DeBeasi
2022-06-15 14:33:25 -04:00
committed by GitHub
parent 1641dbc52a
commit 3abfa780cc

View File

@ -337,6 +337,8 @@ export class Refresher implements ComponentInterface {
this.state !== RefresherState.Completing && this.state !== RefresherState.Completing &&
this.scrollEl!.scrollTop === 0, this.scrollEl!.scrollTop === 0,
onStart: (ev: GestureDetail) => { onStart: (ev: GestureDetail) => {
this.progress = 0;
ev.data = { animation: undefined, didStart: false, cancelled: false }; ev.data = { animation: undefined, didStart: false, cancelled: false };
}, },
onMove: (ev: GestureDetail) => { onMove: (ev: GestureDetail) => {
@ -372,10 +374,10 @@ export class Refresher implements ComponentInterface {
return; return;
} }
this.gesture!.enable(false);
writeTask(() => this.scrollEl!.style.removeProperty('--overflow')); writeTask(() => this.scrollEl!.style.removeProperty('--overflow'));
if (this.progress <= 0.4) { if (this.progress <= 0.4) {
this.gesture!.enable(false);
ev.data.animation.progressEnd(0, this.progress, 500).onFinish(() => { ev.data.animation.progressEnd(0, this.progress, 500).onFinish(() => {
this.animations.forEach((ani) => ani.destroy()); this.animations.forEach((ani) => ani.destroy());
this.animations = []; this.animations = [];
@ -394,6 +396,7 @@ export class Refresher implements ComponentInterface {
await snapBackAnimation.play(); await snapBackAnimation.play();
this.beginRefresh(); this.beginRefresh();
ev.data.animation.destroy(); ev.data.animation.destroy();
this.gesture!.enable(true);
}); });
}, },
}); });