From 6cc040a94eeef0e27469a3ba40393a22b7007959 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 20 May 2024 21:42:49 -0500 Subject: [PATCH] =?UTF-8?q?[=F0=9F=90=B4]=20Add=20end=20of=20list=20text,?= =?UTF-8?q?=20fix=20threshold=20(#4138)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add end of list text * onEndReachedThreshold --- src/components/Lists.tsx | 16 +++++++++++++++- src/screens/Messages/List/index.tsx | 4 +++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/Lists.tsx b/src/components/Lists.tsx index 8cbe2810..47a5bf8f 100644 --- a/src/components/Lists.tsx +++ b/src/components/Lists.tsx @@ -13,12 +13,14 @@ import {Text} from '#/components/Typography' export function ListFooter({ isFetchingNextPage, + hasNextPage, error, onRetry, height, style, }: { isFetchingNextPage?: boolean + hasNextPage?: boolean error?: string onRetry?: () => Promise height?: number @@ -40,7 +42,19 @@ export function ListFooter({ {isFetchingNextPage ? ( ) : ( - + <> + {error ? ( + + ) : ( + <> + {!hasNextPage && ( + + End of list + + )} + + )} + )} ) diff --git a/src/screens/Messages/List/index.tsx b/src/screens/Messages/List/index.tsx index d083ae5b..a0a1d4f8 100644 --- a/src/screens/Messages/List/index.tsx +++ b/src/screens/Messages/List/index.tsx @@ -9,6 +9,7 @@ import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' import {MessagesTabNavigatorParams} from '#/lib/routes/types' import {cleanError} from '#/lib/strings/errors' import {logger} from '#/logger' +import {isNative} from '#/platform/detection' import {useListConvos} from '#/state/queries/messages/list-converations' import {List} from '#/view/com/util/List' import {ViewHeader} from '#/view/com/util/ViewHeader' @@ -248,9 +249,10 @@ export function MessagesScreen({navigation, route}: Props) { error={cleanError(error)} onRetry={fetchNextPage} style={{borderColor: 'transparent'}} + hasNextPage={hasNextPage} /> } - onEndReachedThreshold={3} + onEndReachedThreshold={isNative ? 1.5 : 0} initialNumToRender={initialNumToRender} windowSize={11} // @ts-ignore our .web version only -sfn