Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
add a refresh method
Browse files Browse the repository at this point in the history
  • Loading branch information
alantoa committed Nov 8, 2023
1 parent 18f5813 commit 85a1a80
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/app/components/creator-token/top-creator-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,10 @@ import {
} from "./creator-token-users";

const Header = () => {
const headerHeight = useHeaderHeight();
const router = useRouter();
const isDark = useIsDarkMode();
return (
<>
<View
style={{
paddingTop: Platform.select({
ios: headerHeight,
default: 0,
}),
}}
tw="border-b border-gray-200 pb-4 dark:border-gray-700"
>
<View style={{}} tw="border-b border-gray-200 pb-4 dark:border-gray-700">
<ListHeaderComponent />
<View tw="flex-row items-center justify-between px-4 py-4">
<Text tw="text-gray-1100 text-lg font-bold dark:text-white">
Expand Down Expand Up @@ -103,12 +93,16 @@ export const TopCreatorTokens = ({
limit?: number;
}) => {
const bottom = usePlatformBottomHeight();
const headerHeight = useHeaderHeight();

const { height: screenHeight, width } = useWindowDimensions();
const {
data: list,
isLoading,
fetchMore,
isLoadingMore,
refresh,
isRefreshing,
} = useTopCreatorToken(limit);
const isMdWidth = width >= breakpoints["md"];
const numColumns = 1;
Expand Down Expand Up @@ -172,13 +166,23 @@ export const TopCreatorTokens = ({

return (
<ErrorBoundary>
<View
style={{
height: Platform.select({
ios: headerHeight,
default: 0,
}),
}}
/>
<InfiniteScrollList
useWindowScroll
data={list || []}
ref={listRef}
preserveScrollPosition
keyExtractor={keyExtractor}
numColumns={numColumns}
refreshing={isRefreshing}
onRefresh={refresh}
renderItem={renderItem}
drawDistance={500}
style={{
Expand Down

0 comments on commit 85a1a80

Please sign in to comment.