fix(refresher): progressEnd no longer errors when pulling quickly in MD native refresher (#23056)

This commit is contained in:
Liam DeBeasi
2021-03-16 11:28:10 -04:00
committed by GitHub
parent c877061a32
commit 67617fbc0f

View File

@ -307,6 +307,7 @@ export class Refresher implements ComponentInterface {
canStart: () => this.state !== RefresherState.Refreshing && this.state !== RefresherState.Completing && this.scrollEl!.scrollTop === 0, canStart: () => this.state !== RefresherState.Refreshing && this.state !== RefresherState.Completing && this.scrollEl!.scrollTop === 0,
onStart: (ev: GestureDetail) => { onStart: (ev: GestureDetail) => {
ev.data = { animation: undefined, didStart: false, cancelled: false }; ev.data = { animation: undefined, didStart: false, cancelled: false };
this.state = RefresherState.Pulling;
}, },
onMove: (ev: GestureDetail) => { onMove: (ev: GestureDetail) => {
if ((ev.velocityY < 0 && this.progress === 0 && !ev.data.didStart) || ev.data.cancelled) { if ((ev.velocityY < 0 && this.progress === 0 && !ev.data.didStart) || ev.data.cancelled) {
@ -317,19 +318,14 @@ export class Refresher implements ComponentInterface {
if (!ev.data.didStart) { if (!ev.data.didStart) {
ev.data.didStart = true; ev.data.didStart = true;
this.state = RefresherState.Pulling; writeTask(() => this.scrollEl!.style.setProperty('--overflow', 'hidden'));
writeTask(() => {
const animationType = getRefresherAnimationType(contentEl);
const animation = createPullingAnimation(animationType, pullingRefresherIcon);
ev.data.animation = animation;
this.scrollEl!.style.setProperty('--overflow', 'hidden'); const animationType = getRefresherAnimationType(contentEl);
const animation = createPullingAnimation(animationType, pullingRefresherIcon);
animation.progressStart(false, 0); ev.data.animation = animation;
this.ionStart.emit(); animation.progressStart(false, 0);
this.animations.push(animation); this.ionStart.emit();
}); this.animations.push(animation);
return; return;
} }