Skip to content

bug: refresher, quickly scrolling after cancelling refresh causes duplicate refresh #25418

@milanharia

Description

@milanharia

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

When using an Ion Refresher on android, if you pull the refresher down partially (so it does not trigger the onIonRefresh event) and then scroll down quickly, the refresher animation triggers (but does not fire the refresh event) which causes the scroll to jank.

Expected Behavior

Scrolling down rapidly should not cause the refresher to appear.

Steps to Reproduce

Take any ionic app page which has enough content so the page can scroll and add an IonRefresher. Swipe down on the page slightly so the refresher icon begins to enter the page (but do not trigger it). Swipe up rapidly to scroll the page down quickly and the refresher icon will enter the page and cause the scrolling to jank.

Video Example

22-06-07-11-03-01_01.mp4

An example of the code:


function doRefresh(event: CustomEvent<RefresherEventDetail>) {
  console.log("Begin async operation");

  setTimeout(() => {
    console.log('Async operation has ended');
    event.detail.complete();
  }, 2000);
}

const Tab1: React.FC = () => {
  return (
    <IonPage>
      <IonHeader>
        <IonToolbar>
          <IonTitle>Tab 1</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent fullscreen>
        <IonHeader collapse="condense">
          <IonToolbar>
            <IonTitle size="large">Tab 1</IonTitle>
          </IonToolbar>
        </IonHeader>
        <IonRefresher slot="fixed" onIonRefresh={doRefresh}>
          <IonRefresherContent />
        </IonRefresher>
           {*/ ...Page Content */}
      </IonContent>
    </IonPage>
  );
};

Code Reproduction URL

https://github.com/milanharia/ionic-android-refresher

Ionic Info

Ionic:

Ionic CLI : 6.19.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 6.1.8

Capacitor:

Capacitor CLI : 3.5.1
@capacitor/android : 3.5.1
@capacitor/core : 3.5.1
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 1.6.0

System:

NodeJS : v16.14.2 (/usr/local/bin/node)
npm : 8.7.0
OS : macOS Monterey

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions