14c880123c
Expo app with dashboard, time clock, invoices, and settings — native tabs, glass UI, theme-aware components, and iOS Live Activities. Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import type { ReactNode } from "react";
|
|
import { Platform, ScrollView, type ScrollViewProps, StyleSheet, View } from "react-native";
|
|
|
|
import { tabLayout } from "@/lib/tab-layout";
|
|
import { useTabBarScrollPadding } from "@/lib/tab-bar-insets";
|
|
|
|
type TabScrollViewProps = ScrollViewProps & {
|
|
/** Rendered above screen body — scrolls under the blurred top chrome. */
|
|
header?: ReactNode;
|
|
children: ReactNode;
|
|
};
|
|
|
|
/** Scroll view for native tab screens — content scrolls under the tab bar. */
|
|
export function TabScrollView({
|
|
header,
|
|
children,
|
|
contentContainerStyle,
|
|
style,
|
|
...props
|
|
}: TabScrollViewProps) {
|
|
const scrollPadding = useTabBarScrollPadding();
|
|
|
|
return (
|
|
<ScrollView
|
|
style={[styles.scroll, style]}
|
|
contentContainerStyle={[
|
|
tabLayout.scrollContent,
|
|
{ paddingBottom: scrollPadding },
|
|
contentContainerStyle,
|
|
]}
|
|
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "never" : undefined}
|
|
scrollIndicatorInsets={{ bottom: scrollPadding }}
|
|
{...props}
|
|
>
|
|
{header}
|
|
<View style={tabLayout.scrollBody}>{children}</View>
|
|
</ScrollView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
scroll: {
|
|
flex: 1,
|
|
backgroundColor: "transparent",
|
|
},
|
|
});
|