diff options
author | Paul Frazee <pfrazee@gmail.com> | 2024-11-23 16:20:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-23 16:20:24 -0800 |
commit | 32bf8122e8c8a0fbadd53b8a015cfbc9014519a2 (patch) | |
tree | 55bd24596e6fadadbf4326b26e3d14e418c5c7bb /src/view/com/feeds/ProfileFeedgens.tsx | |
parent | 523d1f01a51c0e85e49916fb42b204f7004ffac1 (diff) | |
parent | b4d07c4112b9a62b5380948051aa4a7fd391a2d4 (diff) | |
download | voidsky-32bf8122e8c8a0fbadd53b8a015cfbc9014519a2.tar.zst |
Merge branch 'main' into main
Diffstat (limited to 'src/view/com/feeds/ProfileFeedgens.tsx')
-rw-r--r-- | src/view/com/feeds/ProfileFeedgens.tsx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/view/com/feeds/ProfileFeedgens.tsx b/src/view/com/feeds/ProfileFeedgens.tsx index 693a8e361..64705ded8 100644 --- a/src/view/com/feeds/ProfileFeedgens.tsx +++ b/src/view/com/feeds/ProfileFeedgens.tsx @@ -1,8 +1,10 @@ import React from 'react' import { + ActivityIndicator, findNodeHandle, ListRenderItemInfo, StyleProp, + StyleSheet, View, ViewStyle, } from 'react-native' @@ -10,6 +12,7 @@ import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useQueryClient} from '@tanstack/react-query' +import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {cleanError} from '#/lib/strings/errors' import {logger} from '#/logger' import {isNative, isWeb} from '#/platform/detection' @@ -57,6 +60,7 @@ export const ProfileFeedgens = React.forwardRef< data, isFetching, isFetched, + isFetchingNextPage, hasNextPage, fetchNextPage, isError, @@ -65,6 +69,7 @@ export const ProfileFeedgens = React.forwardRef< } = useProfileFeedgensQuery(did, opts) const isEmpty = !isFetching && !data?.pages[0]?.feeds.length const {data: preferences} = usePreferencesQuery() + const {isMobile} = useWebMediaQueries() const items = React.useMemo(() => { let items: any[] = [] @@ -180,6 +185,12 @@ export const ProfileFeedgens = React.forwardRef< } }, [enabled, scrollElRef, setScrollViewTag]) + const ProfileFeedgensFooter = React.useCallback(() => { + return isFetchingNextPage ? ( + <ActivityIndicator style={[styles.footer]} /> + ) : null + }, [isFetchingNextPage]) + return ( <View testID={testID} style={style}> <List @@ -188,11 +199,12 @@ export const ProfileFeedgens = React.forwardRef< data={items} keyExtractor={(item: any) => item._reactKey || item.uri} renderItem={renderItem} + ListFooterComponent={ProfileFeedgensFooter} refreshing={isPTRing} onRefresh={onRefresh} headerOffset={headerOffset} progressViewOffset={ios(0)} - contentContainerStyle={isNative && {paddingBottom: headerOffset + 100}} + contentContainerStyle={isMobile && {paddingBottom: headerOffset + 100}} indicatorStyle={t.name === 'light' ? 'black' : 'white'} removeClippedSubviews={true} // @ts-ignore our .web version only -prf @@ -202,3 +214,7 @@ export const ProfileFeedgens = React.forwardRef< </View> ) }) + +const styles = StyleSheet.create({ + footer: {paddingTop: 20}, +}) |