Skip to content

Commit

Permalink
Add route refresh pull down
Browse files Browse the repository at this point in the history
  • Loading branch information
lil5 committed May 27, 2024
1 parent 34bd7b0 commit e84e5be
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/src/pages/AddressList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import {
IonPage,
IonRadio,
IonRadioGroup,
IonRefresher,
IonRefresherContent,
IonSearchbar,
IonTitle,
IonToolbar,
RefresherEventDetail,
} from "@ionic/react";
import { useContext, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
Expand All @@ -30,6 +33,7 @@ import AddressListItem, {
import wrapIndex from "../utils/wrap_index";
import { useDebounce } from "@uidotdev/usehooks";
import IsPaused from "../utils/is_paused";
import { Sleep } from "../utils/sleep";

export default function AddressList() {
const {
Expand Down Expand Up @@ -129,6 +133,14 @@ export default function AddressList() {
return arr;
}, [route, chainUsers, routeListView, slowSearch]);

function handleRefresh(e: CustomEvent<RefresherEventDetail>) {
const refreshPromise = setChain(chain?.uid, authUser);
const sleepPromise = Sleep(500);
Promise.all([refreshPromise, sleepPromise]).then(() => {
e.detail.complete();
});
}

return (
<IonPage>
<OverlayPaused />
Expand Down Expand Up @@ -222,6 +234,13 @@ export default function AddressList() {
</IonToolbar>
</IonHeader>
<IonContent fullscreen>
<IonRefresher
slot="fixed"
onIonRefresh={handleRefresh}
className="tw-z-0"
>
<IonRefresherContent />
</IonRefresher>
<div className="tw-relative tw-min-h-full tw-flex tw-flex-col">
<IonHeader collapse="condense">
<IonToolbar>
Expand Down

0 comments on commit e84e5be

Please sign in to comment.