From b1a87c88923201fd0b31bf55d81b97acc09ddf1c Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Thu, 19 Mar 2020 09:52:49 -0400 Subject: [PATCH] fix(refresher): properly dismiss refresher when completed synchronously (#20815) fixes #20803 --- core/src/components/refresher/refresher.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/components/refresher/refresher.tsx b/core/src/components/refresher/refresher.tsx index 108766fd8df..3b7627821f9 100644 --- a/core/src/components/refresher/refresher.tsx +++ b/core/src/components/refresher/refresher.tsx @@ -3,7 +3,7 @@ import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Meth import { getTimeGivenProgression } from '../../'; import { getIonMode } from '../../global/ionic-global'; import { Animation, Gesture, GestureDetail, RefresherEventDetail } from '../../interface'; -import { clamp } from '../../utils/helpers'; +import { clamp, raf } from '../../utils/helpers'; import { hapticImpact } from '../../utils/native/haptic'; import { createPullingAnimation, createSnapBackAnimation, getRefresherAnimationType, handleScrollWhilePulling, handleScrollWhileRefreshing, setSpinnerOpacity, shouldUseNativeRefresher, transitionEndAsync, translateElement } from './refresher.utils'; @@ -442,7 +442,7 @@ export class Refresher implements ComponentInterface { // Do not reset scroll el until user removes pointer from screen if (!this.pointerDown) { - this.resetNativeRefresher(this.elementToTransform, RefresherState.Completing); + raf(() => raf(() => this.resetNativeRefresher(this.elementToTransform, RefresherState.Completing))); } } else { this.close(RefresherState.Completing, '120ms'); @@ -457,7 +457,7 @@ export class Refresher implements ComponentInterface { if (this.nativeRefresher) { // Do not reset scroll el until user removes pointer from screen if (!this.pointerDown) { - this.resetNativeRefresher(this.elementToTransform, RefresherState.Cancelling); + raf(() => raf(() => this.resetNativeRefresher(this.elementToTransform, RefresherState.Cancelling))); } } else { this.close(RefresherState.Cancelling, '');