This repository has been archived on 2026-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
Gishen-Mob/components/ui/Screen.tsx
kirukib 7310a349c5 Add Gishen mobile app with complete demo shopping and care flows.
Ship Expo Router screens, seeded stores, and polished UX so auth, shop, checkout, prescriptions, loyalty, family, and account processes work end-to-end offline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 01:21:32 +03:00

64 lines
1.6 KiB
TypeScript

import type { ReactNode } from "react";
import {
ScrollView,
View,
type ScrollViewProps,
type StyleProp,
type ViewStyle,
} from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { colors, gutter } from "@/lib/theme";
type ScreenProps = {
children: ReactNode;
/** Adds bottom room for the floating tab bar. */
tabBarPadding?: boolean;
background?: string;
style?: StyleProp<ViewStyle>;
};
export function Screen({ children, background = colors.page, style }: ScreenProps) {
return <View style={[{ flex: 1, backgroundColor: background }, style]}>{children}</View>;
}
type ScreenScrollProps = ScrollViewProps & {
children: ReactNode;
/** Extra bottom inset, e.g. for a sticky bar or the floating tab bar. */
bottomInset?: number;
/** Set false when the screen renders its own header with the top inset. */
topInset?: boolean;
gutters?: boolean;
};
export function ScreenScroll({
children,
bottomInset = 32,
topInset = false,
gutters = true,
contentContainerStyle,
...rest
}: ScreenScrollProps) {
const insets = useSafeAreaInsets();
return (
<ScrollView
showsVerticalScrollIndicator={false}
keyboardShouldPersistTaps="handled"
contentContainerStyle={[
{
paddingTop: topInset ? insets.top + 12 : 0,
paddingBottom: insets.bottom + bottomInset,
paddingHorizontal: gutters ? gutter : 0,
},
contentContainerStyle,
]}
{...rest}
>
{children}
</ScrollView>
);
}
/** Bottom padding that clears the floating tab bar. */
export const TAB_BAR_INSET = 96;