@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
tsx 45 lines 1.62 KB
Raw
1 import { useState } from "react";
2 import { View } from "react-native";
3 import { FormSheet } from "react-native-screens";
4 import { useResolveClassNames } from "uniwind";
5 import { AppBar } from "./AppBar";
6 import { BottomSheetContext } from "./BottomSheetContext";
7 import { RoutedFormSheetContext } from "./RoutedFormSheetContext";
8 import { ScreenContent } from "./ScreenContent";
9 import type { SheetProps } from "./Sheet.types";
10 export type { SheetProps } from "./Sheet.types";
11
12 export function Sheet(props: SheetProps) {
13 const containerStyle = useResolveClassNames("bg-header");
14 const [isOpen, setIsOpen] = useState(true);
15 return (
16 <FormSheet
17 isOpen={isOpen}
18 detents={[0.5, 0.9]}
19 prefersGrabberVisible={false}
20 preventNativeDismiss={props.dismissDisabled}
21 nativeContainerStyle={containerStyle}
22 onDismiss={props.onClose}
23 onNativeDismiss={props.onClose}
24 >
25 <BottomSheetContext value>
26 <RoutedFormSheetContext value={false}>
27 {/* Android FormSheet does not bound flex children. */}
28 <View collapsable={false} className="absolute inset-0 bg-header">
29 <AppBar
30 sheet
31 title={props.title}
32 onBack={props.dismissDisabled ? undefined : () => setIsOpen(false)}
33 hideBottomBorder
34 />
35 <ScreenContent>{props.children}</ScreenContent>
36 <View
37 pointerEvents="none"
38 className="absolute top-1 h-1 w-8 self-center rounded-full bg-header-foreground/40"
39 />
40 </View>
41 </RoutedFormSheetContext>
42 </BottomSheetContext>
43 </FormSheet>
44 );
45 }