import type { ReactNode } from 'react'; import { ScrollView, StyleSheet, useWindowDimensions, View, type StyleProp, type ViewStyle } from 'react-native'; import { SafeAreaView, type Edge } from 'react-native-safe-area-context'; import { colors, size, spacing } from './tokens'; type Props = { children: ReactNode; scroll?: boolean; edges?: Edge[]; style?: StyleProp; contentContainerStyle?: StyleProp; testID?: string; }; /** Consistent canvas, safe-area behavior, horizontal gutter, and readable content width. */ export function Screen({ children, scroll = true, edges = ['top'], style, contentContainerStyle, testID }: Props) { const { width } = useWindowDimensions(); const responsiveGutter = width >= 430 ? size.screenGutterWide : size.screenGutter; const content = scroll ? ( {children} ) : ( {children} ); return {content}; } const styles = StyleSheet.create({ safe: { flex: 1, backgroundColor: colors.neutral.canvas }, scroll: { flex: 1 }, content: { width: '100%', maxWidth: size.contentMaxWidth, alignSelf: 'center', paddingTop: spacing[5], paddingBottom: spacing[8] }, fill: { flex: 1 }, });