Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

worktree-setup-sheet.android.tsx

39 lines1.4 KB

1import { Host, ModalBottomSheet, RNHostView } from "@expo/ui/jetpack-compose";
2import { View, useWindowDimensions } from "react-native";
3import { withUniwind } from "uniwind";
4import { AndroidSheetHeader } from "../../components/ui/AndroidScreenHeader";
5import type { WorktreeSetupSheetProps } from "./worktree-setup-sheet";
6​
7const NativeBottomSheet = withUniwind(ModalBottomSheet, {
8 containerColor: { fromClassName: "containerColorClassName", styleProperty: "accentColor" },
9});
10​
11export function WorktreeSetupSheet({ children, height, onClose }: WorktreeSetupSheetProps) {
12 const window = useWindowDimensions();
13 return (
14 <Host style={{ position: "absolute", width: 0, height: 0 }}>
15 <NativeBottomSheet
16 onDismissRequest={onClose}
17 skipPartiallyExpanded
18 containerColorClassName="accent-sheet-solid"
19 >
20 <RNHostView matchContents>
21 <View
22 style={{
23 width: Math.min(window.width, 640),
24 height: Math.min((height || 360) + 64, window.height * 0.85),
25 }}
26 >
27 <AndroidSheetHeader
28 title="Worktree setup"
29 actions={[
30 { accessibilityLabel: "Close setup details", icon: "xmark", onPress: onClose },
31 ]}
32 />
33 {children}
34 </View>
35 </RNHostView>
36 </NativeBottomSheet>
37 </Host>
38 );