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

_layout.tsx

62 lines2.0 KB

1import Stack from "expo-router/stack";
2import { useCallback } from "react";
3import { useResolveClassNames } from "uniwind";
4​
5import { useClerkSettingsSheetDetent } from "../../features/cloud/ClerkSettingsSheetDetent";
6import { useThemeColor } from "../../lib/useThemeColor";
7​
8export const unstable_settings = {
9 anchor: "index",
10};
11​
12export default function SettingsLayout() {
13 const { collapse } = useClerkSettingsSheetDetent();
14 const contentStyle = useResolveClassNames("bg-sheet");
15 const sheetBg = useThemeColor("--color-sheet");
16 const headerTint = useThemeColor("--color-foreground");
17 const handleExpandedRouteTransitionEnd = useCallback(
18 (event: { data: { closing: boolean } }) => {
19 if (event.data.closing) {
20 collapse();
21 }
22 },
23 [collapse],
24 );
25​
26 return (
27 <Stack
28 screenOptions={{
29 contentStyle,
30 headerBackButtonDisplayMode: "minimal",
31 headerShadowVisible: false,
32 headerStyle: { backgroundColor: sheetBg },
33 headerTintColor: headerTint,
34 headerTitleStyle: { fontFamily: "DMSans_700Bold" },
35 }}
36 >
37 <Stack.Screen name="index" options={{ animation: "none", title: "Settings" }} />
38 <Stack.Screen
39 name="environments"
40 options={{ animation: "slide_from_right", title: "Environments" }}
41 />
42 <Stack.Screen
43 name="environment-new"
44 options={{ animation: "slide_from_right", title: "Add Environment" }}
45 />
46 <Stack.Screen
47 name="waitlist"
48 options={{ animation: "slide_from_right", title: "Join the waitlist" }}
49 />
50 <Stack.Screen
51 name="archive"
52 listeners={{ transitionEnd: handleExpandedRouteTransitionEnd }}
53 options={{ animation: "slide_from_right", title: "Archived Threads" }}
54 />
55 <Stack.Screen
56 name="auth"
57 listeners={{ transitionEnd: handleExpandedRouteTransitionEnd }}
58 options={{ animation: "slide_from_right", title: "Sign in" }}
59 />
60 </Stack>
61 );