Open History to see the last commit
1import type { ReactNode } from "react";
2import { View, type StyleProp, type ViewStyle } from "react-native";
3import { useSafeAreaInsets } from "react-native-safe-area-context";
4
5import { GlassSurface } from "./GlassSurface";
6
7export interface GlassSafeAreaViewProps {
8 readonly leftSlot?: ReactNode;
9 readonly centerSlot?: ReactNode;
10 readonly rightSlot?: ReactNode;
11 readonly style?: StyleProp<ViewStyle>;
12}
13
14export function GlassSafeAreaView({
15 leftSlot,
16 centerSlot,
17 rightSlot,
18 style,
19}: GlassSafeAreaViewProps) {
20 const insets = useSafeAreaInsets();
21 const headerPaddingTop = insets.top + 16;
22
23 return (
24 <View className="border-b border-header-border bg-header" style={style}>
25 <GlassSurface
26 chrome="none"
27 glassEffectStyle="regular"
28 style={{ borderRadius: 0, backgroundColor: "transparent" }}
29 >
30 <View
31 className="flex-row items-center gap-2.5 px-5 pb-4"
32 style={{ paddingTop: headerPaddingTop }}
33 >
34 <View className="items-start justify-center">{leftSlot}</View>
35 <View className="flex-1 items-center justify-center overflow-hidden">{centerSlot}</View>
36 <View className="items-end justify-center">{rightSlot}</View>
37 </View>
38 </GlassSurface>
39 </View>
40 );
41}