Open History to see the last commit
1import { useState } from "react";
2import { View } from "react-native";
3import { FormSheet } from "react-native-screens";
4import { useResolveClassNames } from "uniwind";
5import { AndroidSheetHeader } from "./AndroidScreenHeader";
6import type { SheetProps } from "./Sheet.types";
7export type { SheetProps } from "./Sheet.types";
8
9export function Sheet(props: SheetProps) {
10 const containerStyle = useResolveClassNames("bg-sheet");
11 const [isOpen, setIsOpen] = useState(true);
12 return (
13 <FormSheet
14 isOpen={isOpen}
15 detents={[0.5, 0.9]}
16 prefersGrabberVisible
17 nativeContainerStyle={containerStyle}
18 onDismiss={props.onClose}
19 onNativeDismiss={props.onClose}
20 >
21 {/* Android FormSheet does not bound flex children. Material drags target the first scroll view, so place content before the header. */}
22 <View collapsable={false} className="absolute inset-0 flex-col-reverse bg-sheet">
23 <View className="flex-1">{props.children}</View>
24 <AndroidSheetHeader title={props.title} onBack={() => setIsOpen(false)} />
25 </View>
26 </FormSheet>
27 );
28}