diff --git a/apps/mobile/src/components/common/SafeNavigationScrollView.tsx b/apps/mobile/src/components/common/SafeNavigationScrollView.tsx index eeaa6d860..a472d6ca8 100644 --- a/apps/mobile/src/components/common/SafeNavigationScrollView.tsx +++ b/apps/mobile/src/components/common/SafeNavigationScrollView.tsx @@ -29,7 +29,7 @@ type SafeNavigationScrollViewProps = Omit & { withTopInset?: boolean withBottomInset?: boolean } & PropsWithChildren -const NavigationContext = createContext<{ +export const NavigationContext = createContext<{ scrollY: RNAnimated.Value } | null>(null) diff --git a/apps/mobile/src/modules/entry-list/entry-list.tsx b/apps/mobile/src/modules/entry-list/entry-list.tsx index f40dd9ae1..b3f479240 100644 --- a/apps/mobile/src/modules/entry-list/entry-list.tsx +++ b/apps/mobile/src/modules/entry-list/entry-list.tsx @@ -1,14 +1,17 @@ import type { FeedViewType } from "@follow/constants" import { useTypeScriptHappyCallback } from "@follow/hooks" +import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs" +import { useHeaderHeight } from "@react-navigation/elements" import { useIsFocused } from "@react-navigation/native" import { FlashList } from "@shopify/flash-list" import { router } from "expo-router" -import { useCallback, useEffect } from "react" -import { Image, StyleSheet, Text, View } from "react-native" +import { useCallback, useEffect, useMemo } from "react" +import { Image, StyleSheet, Text, useAnimatedValue, View } from "react-native" +import { useSafeAreaInsets } from "react-native-safe-area-context" import { NavigationBlurEffectHeader, - SafeNavigationScrollView, + NavigationContext, } from "@/src/components/common/SafeNavigationScrollView" import { ItemPressable } from "@/src/components/ui/pressable/item-pressable" import { @@ -94,9 +97,14 @@ function InboxEntryList({ inboxId }: { inboxId: string }) { const entryIds = useEntryIdsByInboxId(inboxId) return } + function EntryListScreen({ title, entryIds }: { title: string; entryIds: string[] }) { + const scrollY = useAnimatedValue(0) + const insets = useSafeAreaInsets() + const tabBarHeight = useBottomTabBarHeight() + const headerHeight = useHeaderHeight() return ( - + ({ scrollY }), [scrollY])}> - - ( - - ), - [], - )} - estimatedItemSize={100} - ItemSeparatorComponent={ItemSeparator} - /> - - + { + scrollY.setValue(e.nativeEvent.contentOffset.y) + }, + [scrollY], + )} + data={entryIds} + renderItem={useTypeScriptHappyCallback( + ({ item: id }) => ( + + ), + [], + )} + scrollIndicatorInsets={{ + top: headerHeight - insets.top, + bottom: tabBarHeight - insets.bottom, + }} + estimatedItemSize={100} + contentContainerStyle={{ + paddingTop: headerHeight, + paddingBottom: tabBarHeight, + }} + ItemSeparatorComponent={ItemSeparator} + /> + ) }