Skip to content

Commit ad28cc2

Browse files
Fix Activity Feed scroll
1 parent 866c9f8 commit ad28cc2

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

packages/app/features/activity/RecentActivity.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { H4, Paragraph, Spinner, useMedia, XStack, YStack } from '@my/ui'
1+
import { Card, H4, Paragraph, Spinner, useMedia, XStack, YStack } from '@my/ui'
22
import type { PostgrestError } from '@supabase/postgrest-js'
33
import type { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query'
44
import { ActivityDetails } from 'app/features/activity/ActivityDetails'
@@ -26,14 +26,7 @@ export function RecentActivity() {
2626
}
2727

2828
return (
29-
<XStack
30-
w={'100%'}
31-
gap={'$5'}
32-
f={1}
33-
$gtLg={{
34-
height: 0,
35-
}}
36-
>
29+
<XStack w={'100%'} gap={'$5'} f={1}>
3730
<YStack
3831
f={1}
3932
display={selectedActivity && queryParams.activity ? 'none' : 'flex'}
@@ -49,6 +42,11 @@ export function RecentActivity() {
4942
activity={selectedActivity}
5043
onClose={handleCloseActivityDetails}
5144
w={'100%'}
45+
$platform-web={{
46+
height: 'fit-content',
47+
position: 'sticky',
48+
top: 10,
49+
}}
5250
$gtLg={{
5351
maxWidth: '47%',
5452
}}
@@ -66,7 +64,6 @@ function ActivityFeed({
6664
onActivityPress: (activity: Activity) => void
6765
}) {
6866
const { isAtEnd } = useScrollDirection()
69-
const media = useMedia()
7067

7168
const {
7269
data,
@@ -78,10 +75,10 @@ function ActivityFeed({
7875
} = activityFeedQuery
7976

8077
useEffect(() => {
81-
if (isAtEnd && !media.gtLg && hasNextPage && !isFetchingNextPageActivities) {
78+
if (isAtEnd && hasNextPage && !isFetchingNextPageActivities) {
8279
fetchNextPage()
8380
}
84-
}, [isAtEnd, hasNextPage, fetchNextPage, isFetchingNextPageActivities, media.gtLg])
81+
}, [isAtEnd, hasNextPage, fetchNextPage, isFetchingNextPageActivities])
8582

8683
const sections = useMemo(() => {
8784
if (!data?.pages) return []
@@ -129,6 +126,7 @@ function ActivityFeed({
129126

130127
return (
131128
<SectionList
129+
style={{ flex: 1 }}
132130
sections={sections}
133131
testID={'RecentActivity'}
134132
showsVerticalScrollIndicator={false}
@@ -167,7 +165,6 @@ function ActivityFeed({
167165
renderSectionHeader={({ section: { title, index } }) => (
168166
<RowLabel first={index === 0}>{title}</RowLabel>
169167
)}
170-
onEndReached={() => hasNextPage && media.gtLg && fetchNextPage()}
171168
ListFooterComponent={
172169
!isLoadingActivities && isFetchingNextPageActivities ? <Spinner size="small" /> : null
173170
}

packages/app/features/activity/utils/useActivityFeed.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export function useActivityFeed({
3434
> {
3535
const supabase = useSupabase()
3636
const addressBook = useAddressBook()
37+
console.log(addressBook)
3738
const enabled = useMemo(() => addressBook.isError || addressBook.isSuccess, [addressBook])
3839
const queryKey = useMemo(
3940
() => ['activity_feed', { addressBook, supabase, pageSize }] as const,

0 commit comments

Comments
 (0)