-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_layout.tsx
More file actions
82 lines (80 loc) · 2.7 KB
/
_layout.tsx
File metadata and controls
82 lines (80 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { Stack } from 'expo-router';
import { useRef } from 'react';
import { Feather } from '@expo/vector-icons';
import { router } from 'expo-router';
import { Pressable } from 'react-native';
import { ThemeProvider, ThemeContext } from '@/theme/ThemeContext';
import { ThemedText } from '@/components/ThemedText';
import Toast from 'react-native-toast-message';
export default function Layout() {
const themeContextRef = useRef<{ theme: string; toggleTheme: () => void } | null>(null);
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<ThemeProvider>
<ThemeContext.Consumer>
{themeContext => {
themeContextRef.current = themeContext;
return (
<Stack
screenOptions={{
headerShown: true,
headerStyle: {
backgroundColor: themeContext?.theme === "dark" ? "#18181b" : "#fff"
},
headerTitleStyle: {
color: themeContext?.theme === "dark" ? "#fff" : "#222"
},
headerLeft: ({ canGoBack }) =>
canGoBack ? (
<Pressable onPress={() => router.back()} style={{ paddingHorizontal: 12 }}>
<Feather name="arrow-left" size={24} color={themeContext?.theme === "dark" ? "#fff" : "black"} />
</Pressable>
) : null
}}
>
<Stack.Screen
name="index"
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="caffeine"
options={{
title: "Caffeine Tracker",
}}
/>
<Stack.Screen
name="toilet"
options={{
title: "Toilet Logs"
}}
/>
<Stack.Screen
name="createTracker"
options={{
title: "Create Tracker"
}}
/>
<Stack.Screen
name="customTrackers"
options={{
headerShown: false
}}
/>
<Stack.Screen
name="settings"
options={{
title: "Settings",
}}
/>
</Stack>
);
}}
</ThemeContext.Consumer>
<Toast/>
</ThemeProvider>
</GestureHandlerRootView>
);
}