Open History to see the last commit
1import type { ReactNode } from "react";
2import { Platform, View } from "react-native";
3
4/** Keeps the header surface visible behind rounded Android content corners. */
5export function ScreenContent({
6 children,
7 insetHorizontal = false,
8 fitToContents = false,
9}: {
10 readonly children: ReactNode;
11 readonly insetHorizontal?: boolean;
12 readonly fitToContents?: boolean;
13}) {
14 if (Platform.OS !== "android") return children;
15
16 return (
17 <View className={fitToContents ? "shrink bg-header" : "flex-1 bg-header"}>
18 <View
19 className="overflow-hidden rounded-t-[28px] bg-sheet-solid"
20 style={{
21 flexShrink: 1,
22 flexGrow: fitToContents ? 0 : 1,
23 flexBasis: fitToContents ? "auto" : 0,
24 marginHorizontal: insetHorizontal ? 4 : 0,
25 }}
26 >
27 {children}
28 </View>
29 </View>
30 );
31}