refactor(rn): subscription drawer layout

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-01-14 20:25:35 +08:00
parent fe44c38b49
commit 2edebdfcdb
9 changed files with 89 additions and 68 deletions
@@ -1,7 +1,7 @@
import { StyleSheet, View } from "react-native"
const el = (
<View className="bg-opaque-separator w-full" style={{ height: StyleSheet.hairlineWidth }} />
<View className="bg-opaque-separator ml-12 flex-1" style={{ height: StyleSheet.hairlineWidth }} />
)
export const ItemSeparator = () => {
return el
@@ -62,7 +62,7 @@ export const SubscriptionLists = memo(() => {
].map((view) => {
return (
<ViewPageCurrentViewProvider key={view} value={view}>
<SubscriptionList view={view} />
<SubscriptionList view={view} additionalOffsetTop={ViewTabHeight * 2 + 23} />
</ViewPageCurrentViewProvider>
)
})}
@@ -75,7 +75,13 @@ const keyExtractor = (item: string | { category: string; subscriptionIds: string
}
return item.category
}
const SubscriptionList = ({ view }: { view: FeedViewType }) => {
export const SubscriptionList = ({
view,
additionalOffsetTop,
}: {
view: FeedViewType
additionalOffsetTop?: number
}) => {
const headerHeight = useHeaderHeight()
const insets = useSafeAreaInsets()
const tabHeight = useBottomTabBarHeight()
@@ -97,13 +103,13 @@ const SubscriptionList = ({ view }: { view: FeedViewType }) => {
return subscriptionSyncService.fetch(view)
})
const offsetTop = headerHeight - insets.top + ViewTabHeight * 2 + 23
const offsetTop = headerHeight - insets.top + (additionalOffsetTop || 0)
return (
<ReAnimated.FlatList
refreshControl={
<RefreshControl
progressViewOffset={offsetTop}
progressViewOffset={headerHeight}
onRefresh={() => {
setRefreshing(true)
onRefresh().finally(() => {