create-croissant 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/apps/mobile/README.md +3 -3
- package/template/apps/mobile/app/(tabs)/_layout.tsx +17 -25
- package/template/apps/mobile/app/(tabs)/explore.tsx +104 -337
- package/template/apps/mobile/app/(tabs)/index.tsx +85 -99
- package/template/apps/mobile/app/_layout.tsx +13 -32
- package/template/apps/mobile/app/modal.tsx +29 -0
- package/template/apps/mobile/app.json +6 -14
- package/template/apps/mobile/components/external-link.tsx +5 -5
- package/template/apps/mobile/components/haptic-tab.tsx +4 -4
- package/template/apps/mobile/components/hello-wave.tsx +4 -5
- package/template/apps/mobile/components/parallax-scroll-view.tsx +13 -15
- package/template/apps/mobile/components/themed-text.tsx +14 -14
- package/template/apps/mobile/components/themed-view.tsx +3 -3
- package/template/apps/mobile/components/ui/collapsible.tsx +13 -14
- package/template/apps/mobile/components/ui/icon-symbol.ios.tsx +4 -4
- package/template/apps/mobile/components/ui/icon-symbol.tsx +9 -9
- package/template/apps/mobile/constants/theme.ts +19 -19
- package/template/apps/mobile/hooks/use-color-scheme.ts +1 -1
- package/template/apps/mobile/hooks/use-color-scheme.web.ts +3 -3
- package/template/apps/mobile/hooks/use-theme-color.ts +4 -4
- package/template/apps/mobile/package.json +26 -38
- package/template/apps/mobile/scripts/reset-project.js +2 -2
- package/template/apps/mobile/tsconfig.json +9 -2
- package/template/apps/platform/src/routes/api/auth/$.ts +1 -1
- package/template/apps/platform/src/routes/api/rpc.$.ts +2 -2
- package/template/package.json +12 -14
- package/template/pnpm-workspace.yaml +8 -0
- package/template/tsconfig.json +1 -2
- package/template/apps/mobile/app/(tabs)/account.tsx +0 -147
- package/template/apps/mobile/app/index.tsx +0 -129
- package/template/apps/mobile/app/login.tsx +0 -135
- package/template/apps/mobile/app/signup.tsx +0 -144
- package/template/apps/mobile/components/ui/button.tsx +0 -86
- package/template/apps/mobile/components/ui/input.tsx +0 -56
- package/template/apps/mobile/lib/auth-client.ts +0 -14
- package/template/apps/mobile/lib/orpc.ts +0 -28
|
@@ -1,112 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useRouter } from "expo-router";
|
|
4
|
-
import { authClient } from "@/lib/auth-client";
|
|
5
|
-
import { useSecretData } from "@workspace/orpc/react";
|
|
6
|
-
import { Button } from "@/components/ui/button";
|
|
1
|
+
import { Image } from 'expo-image';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
enabled: !!session,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (!isAuthPending && !session) {
|
|
18
|
-
router.replace("/login");
|
|
19
|
-
}
|
|
20
|
-
}, [session, isAuthPending, router]);
|
|
21
|
-
|
|
22
|
-
const handleSignOut = async () => {
|
|
23
|
-
await authClient.signOut();
|
|
24
|
-
router.replace("/");
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
if (isAuthPending) {
|
|
28
|
-
return (
|
|
29
|
-
<View style={styles.center}>
|
|
30
|
-
<Text>Loading dashboard...</Text>
|
|
31
|
-
</View>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
4
|
+
import { HelloWave } from '@/components/hello-wave';
|
|
5
|
+
import ParallaxScrollView from '@/components/parallax-scroll-view';
|
|
6
|
+
import { ThemedText } from '@/components/themed-text';
|
|
7
|
+
import { ThemedView } from '@/components/themed-view';
|
|
8
|
+
import { Link } from 'expo-router';
|
|
34
9
|
|
|
10
|
+
export default function HomeScreen() {
|
|
35
11
|
return (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
12
|
+
<ParallaxScrollView
|
|
13
|
+
headerBackgroundColor={{ light: '#A1CEDC', dark: '#1D3D47' }}
|
|
14
|
+
headerImage={
|
|
15
|
+
<Image
|
|
16
|
+
source={require('@/assets/images/partial-react-logo.png')}
|
|
17
|
+
style={styles.reactLogo}
|
|
18
|
+
/>
|
|
19
|
+
}>
|
|
20
|
+
<ThemedView style={styles.titleContainer}>
|
|
21
|
+
<ThemedText type="title">Welcome!</ThemedText>
|
|
22
|
+
<HelloWave />
|
|
23
|
+
</ThemedView>
|
|
24
|
+
<ThemedView style={styles.stepContainer}>
|
|
25
|
+
<ThemedText type="subtitle">Step 1: Try it</ThemedText>
|
|
26
|
+
<ThemedText>
|
|
27
|
+
Edit <ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> to see changes.
|
|
28
|
+
Press{' '}
|
|
29
|
+
<ThemedText type="defaultSemiBold">
|
|
30
|
+
{Platform.select({
|
|
31
|
+
ios: 'cmd + d',
|
|
32
|
+
android: 'cmd + m',
|
|
33
|
+
web: 'F12',
|
|
34
|
+
})}
|
|
35
|
+
</ThemedText>{' '}
|
|
36
|
+
to open developer tools.
|
|
37
|
+
</ThemedText>
|
|
38
|
+
</ThemedView>
|
|
39
|
+
<ThemedView style={styles.stepContainer}>
|
|
40
|
+
<Link href="/modal">
|
|
41
|
+
<Link.Trigger>
|
|
42
|
+
<ThemedText type="subtitle">Step 2: Explore</ThemedText>
|
|
43
|
+
</Link.Trigger>
|
|
44
|
+
<Link.Preview />
|
|
45
|
+
<Link.Menu>
|
|
46
|
+
<Link.MenuAction title="Action" icon="cube" onPress={() => alert('Action pressed')} />
|
|
47
|
+
<Link.MenuAction
|
|
48
|
+
title="Share"
|
|
49
|
+
icon="square.and.arrow.up"
|
|
50
|
+
onPress={() => alert('Share pressed')}
|
|
51
|
+
/>
|
|
52
|
+
<Link.Menu title="More" icon="ellipsis">
|
|
53
|
+
<Link.MenuAction
|
|
54
|
+
title="Delete"
|
|
55
|
+
icon="trash"
|
|
56
|
+
destructive
|
|
57
|
+
onPress={() => alert('Delete pressed')}
|
|
58
|
+
/>
|
|
59
|
+
</Link.Menu>
|
|
60
|
+
</Link.Menu>
|
|
61
|
+
</Link>
|
|
55
62
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
<ThemedText>
|
|
64
|
+
{`Tap the Explore tab to learn more about what's included in this starter app.`}
|
|
65
|
+
</ThemedText>
|
|
66
|
+
</ThemedView>
|
|
67
|
+
<ThemedView style={styles.stepContainer}>
|
|
68
|
+
<ThemedText type="subtitle">Step 3: Get a fresh start</ThemedText>
|
|
69
|
+
<ThemedText>
|
|
70
|
+
{`When you're ready, run `}
|
|
71
|
+
<ThemedText type="defaultSemiBold">npm run reset-project</ThemedText> to get a fresh{' '}
|
|
72
|
+
<ThemedText type="defaultSemiBold">app</ThemedText> directory. This will move the current{' '}
|
|
73
|
+
<ThemedText type="defaultSemiBold">app</ThemedText> to{' '}
|
|
74
|
+
<ThemedText type="defaultSemiBold">app-example</ThemedText>.
|
|
75
|
+
</ThemedText>
|
|
76
|
+
</ThemedView>
|
|
77
|
+
</ParallaxScrollView>
|
|
60
78
|
);
|
|
61
79
|
}
|
|
62
80
|
|
|
63
81
|
const styles = StyleSheet.create({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
content: {
|
|
69
|
-
padding: 24,
|
|
70
|
-
},
|
|
71
|
-
center: {
|
|
72
|
-
flex: 1,
|
|
73
|
-
justifyContent: "center",
|
|
74
|
-
alignItems: "center",
|
|
75
|
-
},
|
|
76
|
-
title: {
|
|
77
|
-
fontSize: 28,
|
|
78
|
-
fontWeight: "bold",
|
|
79
|
-
marginBottom: 8,
|
|
82
|
+
titleContainer: {
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
gap: 8,
|
|
80
86
|
},
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
stepContainer: {
|
|
88
|
+
gap: 8,
|
|
83
89
|
marginBottom: 8,
|
|
84
90
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
padding: 16,
|
|
92
|
-
backgroundColor: "#f9f9f9",
|
|
93
|
-
borderRadius: 8,
|
|
94
|
-
borderWidth: 1,
|
|
95
|
-
borderColor: "#eee",
|
|
96
|
-
marginBottom: 24,
|
|
97
|
-
},
|
|
98
|
-
secureTitle: {
|
|
99
|
-
fontWeight: "600",
|
|
100
|
-
marginBottom: 8,
|
|
101
|
-
},
|
|
102
|
-
secureContent: {
|
|
103
|
-
fontFamily: Platform.OS === "ios" ? "Courier" : "monospace",
|
|
104
|
-
fontSize: 12,
|
|
105
|
-
},
|
|
106
|
-
errorText: {
|
|
107
|
-
color: "#ef4444",
|
|
108
|
-
},
|
|
109
|
-
signOutBtn: {
|
|
110
|
-
marginTop: 12,
|
|
91
|
+
reactLogo: {
|
|
92
|
+
height: 178,
|
|
93
|
+
width: 290,
|
|
94
|
+
bottom: 0,
|
|
95
|
+
left: 0,
|
|
96
|
+
position: 'absolute',
|
|
111
97
|
},
|
|
112
98
|
});
|
|
@@ -1,43 +1,24 @@
|
|
|
1
|
-
import { DarkTheme, DefaultTheme, ThemeProvider } from
|
|
2
|
-
import { Stack } from
|
|
3
|
-
import { StatusBar } from
|
|
4
|
-
import
|
|
5
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
6
|
-
import { ORPCProvider } from "@workspace/orpc/react";
|
|
7
|
-
import { orpc } from "@/lib/orpc";
|
|
1
|
+
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
|
|
2
|
+
import { Stack } from 'expo-router';
|
|
3
|
+
import { StatusBar } from 'expo-status-bar';
|
|
4
|
+
import 'react-native-reanimated';
|
|
8
5
|
|
|
9
|
-
import { useColorScheme } from
|
|
10
|
-
|
|
11
|
-
const queryClient = new QueryClient({
|
|
12
|
-
defaultOptions: {
|
|
13
|
-
mutations: {
|
|
14
|
-
onError: (error) => {
|
|
15
|
-
console.error("Global Mutation Error:", error);
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
});
|
|
6
|
+
import { useColorScheme } from '@/hooks/use-color-scheme';
|
|
20
7
|
|
|
21
8
|
export const unstable_settings = {
|
|
22
|
-
anchor:
|
|
9
|
+
anchor: '(tabs)',
|
|
23
10
|
};
|
|
24
11
|
|
|
25
12
|
export default function RootLayout() {
|
|
26
13
|
const colorScheme = useColorScheme();
|
|
27
14
|
|
|
28
15
|
return (
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<Stack.Screen name="signup" options={{ title: "Sign Up" }} />
|
|
37
|
-
</Stack>
|
|
38
|
-
<StatusBar style="auto" />
|
|
39
|
-
</ThemeProvider>
|
|
40
|
-
</ORPCProvider>
|
|
41
|
-
</QueryClientProvider>
|
|
16
|
+
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
|
|
17
|
+
<Stack>
|
|
18
|
+
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
19
|
+
<Stack.Screen name="modal" options={{ presentation: 'modal', title: 'Modal' }} />
|
|
20
|
+
</Stack>
|
|
21
|
+
<StatusBar style="auto" />
|
|
22
|
+
</ThemeProvider>
|
|
42
23
|
);
|
|
43
24
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Link } from 'expo-router';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { ThemedText } from '@/components/themed-text';
|
|
5
|
+
import { ThemedView } from '@/components/themed-view';
|
|
6
|
+
|
|
7
|
+
export default function ModalScreen() {
|
|
8
|
+
return (
|
|
9
|
+
<ThemedView style={styles.container}>
|
|
10
|
+
<ThemedText type="title">This is a modal</ThemedText>
|
|
11
|
+
<Link href="/" dismissTo style={styles.link}>
|
|
12
|
+
<ThemedText type="link">Go to home screen</ThemedText>
|
|
13
|
+
</Link>
|
|
14
|
+
</ThemedView>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
padding: 20,
|
|
24
|
+
},
|
|
25
|
+
link: {
|
|
26
|
+
marginTop: 15,
|
|
27
|
+
paddingVertical: 15,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -9,12 +9,7 @@
|
|
|
9
9
|
"userInterfaceStyle": "automatic",
|
|
10
10
|
"newArchEnabled": true,
|
|
11
11
|
"ios": {
|
|
12
|
-
"supportsTablet": true
|
|
13
|
-
"infoPlist": {
|
|
14
|
-
"NSAppTransportSecurity": {
|
|
15
|
-
"NSAllowsLocalNetworking": true
|
|
16
|
-
}
|
|
17
|
-
}
|
|
12
|
+
"supportsTablet": true
|
|
18
13
|
},
|
|
19
14
|
"android": {
|
|
20
15
|
"adaptiveIcon": {
|
|
@@ -27,9 +22,8 @@
|
|
|
27
22
|
"predictiveBackGestureEnabled": false
|
|
28
23
|
},
|
|
29
24
|
"web": {
|
|
30
|
-
"output": "
|
|
31
|
-
"favicon": "./assets/images/favicon.png"
|
|
32
|
-
"bundler": "metro"
|
|
25
|
+
"output": "static",
|
|
26
|
+
"favicon": "./assets/images/favicon.png"
|
|
33
27
|
},
|
|
34
28
|
"plugins": [
|
|
35
29
|
"expo-router",
|
|
@@ -44,13 +38,11 @@
|
|
|
44
38
|
"backgroundColor": "#000000"
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
|
-
]
|
|
48
|
-
"expo-font",
|
|
49
|
-
"expo-image",
|
|
50
|
-
"expo-web-browser"
|
|
41
|
+
]
|
|
51
42
|
],
|
|
52
43
|
"experiments": {
|
|
53
|
-
"typedRoutes": true
|
|
44
|
+
"typedRoutes": true,
|
|
45
|
+
"reactCompiler": true
|
|
54
46
|
}
|
|
55
47
|
}
|
|
56
48
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Href, Link } from
|
|
2
|
-
import { openBrowserAsync, WebBrowserPresentationStyle } from
|
|
3
|
-
import { type ComponentProps } from
|
|
1
|
+
import { Href, Link } from 'expo-router';
|
|
2
|
+
import { openBrowserAsync, WebBrowserPresentationStyle } from 'expo-web-browser';
|
|
3
|
+
import { type ComponentProps } from 'react';
|
|
4
4
|
|
|
5
|
-
type Props = Omit<ComponentProps<typeof Link>,
|
|
5
|
+
type Props = Omit<ComponentProps<typeof Link>, 'href'> & { href: Href & string };
|
|
6
6
|
|
|
7
7
|
export function ExternalLink({ href, ...rest }: Props) {
|
|
8
8
|
return (
|
|
@@ -11,7 +11,7 @@ export function ExternalLink({ href, ...rest }: Props) {
|
|
|
11
11
|
{...rest}
|
|
12
12
|
href={href}
|
|
13
13
|
onPress={async (event) => {
|
|
14
|
-
if (process.env.EXPO_OS !==
|
|
14
|
+
if (process.env.EXPO_OS !== 'web') {
|
|
15
15
|
// Prevent the default behavior of linking to the default browser on native.
|
|
16
16
|
event.preventDefault();
|
|
17
17
|
// Open the link in an in-app browser.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { BottomTabBarButtonProps } from
|
|
2
|
-
import { PlatformPressable } from
|
|
3
|
-
import * as Haptics from
|
|
1
|
+
import { BottomTabBarButtonProps } from '@react-navigation/bottom-tabs';
|
|
2
|
+
import { PlatformPressable } from '@react-navigation/elements';
|
|
3
|
+
import * as Haptics from 'expo-haptics';
|
|
4
4
|
|
|
5
5
|
export function HapticTab(props: BottomTabBarButtonProps) {
|
|
6
6
|
return (
|
|
7
7
|
<PlatformPressable
|
|
8
8
|
{...props}
|
|
9
9
|
onPressIn={(ev) => {
|
|
10
|
-
if (process.env.EXPO_OS ===
|
|
10
|
+
if (process.env.EXPO_OS === 'ios') {
|
|
11
11
|
// Add a soft haptic feedback when pressing down on the tabs.
|
|
12
12
|
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Animated from
|
|
1
|
+
import Animated from 'react-native-reanimated';
|
|
2
2
|
|
|
3
3
|
export function HelloWave() {
|
|
4
4
|
return (
|
|
@@ -8,12 +8,11 @@ export function HelloWave() {
|
|
|
8
8
|
lineHeight: 32,
|
|
9
9
|
marginTop: -6,
|
|
10
10
|
animationName: {
|
|
11
|
-
|
|
11
|
+
'50%': { transform: [{ rotate: '25deg' }] },
|
|
12
12
|
},
|
|
13
13
|
animationIterationCount: 4,
|
|
14
|
-
animationDuration:
|
|
15
|
-
}}
|
|
16
|
-
>
|
|
14
|
+
animationDuration: '300ms',
|
|
15
|
+
}}>
|
|
17
16
|
👋
|
|
18
17
|
</Animated.Text>
|
|
19
18
|
);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { PropsWithChildren, ReactElement } from
|
|
2
|
-
import { StyleSheet } from
|
|
1
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
3
|
import Animated, {
|
|
4
4
|
interpolate,
|
|
5
5
|
useAnimatedRef,
|
|
6
6
|
useAnimatedStyle,
|
|
7
7
|
useScrollOffset,
|
|
8
|
-
} from
|
|
8
|
+
} from 'react-native-reanimated';
|
|
9
9
|
|
|
10
|
-
import { ThemedView } from
|
|
11
|
-
import { useColorScheme } from
|
|
12
|
-
import { useThemeColor } from
|
|
10
|
+
import { ThemedView } from '@/components/themed-view';
|
|
11
|
+
import { useColorScheme } from '@/hooks/use-color-scheme';
|
|
12
|
+
import { useThemeColor } from '@/hooks/use-theme-color';
|
|
13
13
|
|
|
14
14
|
const HEADER_HEIGHT = 250;
|
|
15
15
|
|
|
@@ -23,8 +23,8 @@ export default function ParallaxScrollView({
|
|
|
23
23
|
headerImage,
|
|
24
24
|
headerBackgroundColor,
|
|
25
25
|
}: Props) {
|
|
26
|
-
const backgroundColor = useThemeColor({},
|
|
27
|
-
const colorScheme = useColorScheme() ??
|
|
26
|
+
const backgroundColor = useThemeColor({}, 'background');
|
|
27
|
+
const colorScheme = useColorScheme() ?? 'light';
|
|
28
28
|
const scrollRef = useAnimatedRef<Animated.ScrollView>();
|
|
29
29
|
const scrollOffset = useScrollOffset(scrollRef);
|
|
30
30
|
const headerAnimatedStyle = useAnimatedStyle(() => {
|
|
@@ -34,7 +34,7 @@ export default function ParallaxScrollView({
|
|
|
34
34
|
translateY: interpolate(
|
|
35
35
|
scrollOffset.value,
|
|
36
36
|
[-HEADER_HEIGHT, 0, HEADER_HEIGHT],
|
|
37
|
-
[-HEADER_HEIGHT / 2, 0, HEADER_HEIGHT * 0.75]
|
|
37
|
+
[-HEADER_HEIGHT / 2, 0, HEADER_HEIGHT * 0.75]
|
|
38
38
|
),
|
|
39
39
|
},
|
|
40
40
|
{
|
|
@@ -48,15 +48,13 @@ export default function ParallaxScrollView({
|
|
|
48
48
|
<Animated.ScrollView
|
|
49
49
|
ref={scrollRef}
|
|
50
50
|
style={{ backgroundColor, flex: 1 }}
|
|
51
|
-
scrollEventThrottle={16}
|
|
52
|
-
>
|
|
51
|
+
scrollEventThrottle={16}>
|
|
53
52
|
<Animated.View
|
|
54
53
|
style={[
|
|
55
54
|
styles.header,
|
|
56
55
|
{ backgroundColor: headerBackgroundColor[colorScheme] },
|
|
57
56
|
headerAnimatedStyle,
|
|
58
|
-
]}
|
|
59
|
-
>
|
|
57
|
+
]}>
|
|
60
58
|
{headerImage}
|
|
61
59
|
</Animated.View>
|
|
62
60
|
<ThemedView style={styles.content}>{children}</ThemedView>
|
|
@@ -70,12 +68,12 @@ const styles = StyleSheet.create({
|
|
|
70
68
|
},
|
|
71
69
|
header: {
|
|
72
70
|
height: HEADER_HEIGHT,
|
|
73
|
-
overflow:
|
|
71
|
+
overflow: 'hidden',
|
|
74
72
|
},
|
|
75
73
|
content: {
|
|
76
74
|
flex: 1,
|
|
77
75
|
padding: 32,
|
|
78
76
|
gap: 16,
|
|
79
|
-
overflow:
|
|
77
|
+
overflow: 'hidden',
|
|
80
78
|
},
|
|
81
79
|
});
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { StyleSheet, Text, type TextProps } from
|
|
1
|
+
import { StyleSheet, Text, type TextProps } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { useThemeColor } from
|
|
3
|
+
import { useThemeColor } from '@/hooks/use-theme-color';
|
|
4
4
|
|
|
5
5
|
export type ThemedTextProps = TextProps & {
|
|
6
6
|
lightColor?: string;
|
|
7
7
|
darkColor?: string;
|
|
8
|
-
type?:
|
|
8
|
+
type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link';
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export function ThemedText({
|
|
12
12
|
style,
|
|
13
13
|
lightColor,
|
|
14
14
|
darkColor,
|
|
15
|
-
type =
|
|
15
|
+
type = 'default',
|
|
16
16
|
...rest
|
|
17
17
|
}: ThemedTextProps) {
|
|
18
|
-
const color = useThemeColor({ light: lightColor, dark: darkColor },
|
|
18
|
+
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text');
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<Text
|
|
22
22
|
style={[
|
|
23
23
|
{ color },
|
|
24
|
-
type ===
|
|
25
|
-
type ===
|
|
26
|
-
type ===
|
|
27
|
-
type ===
|
|
28
|
-
type ===
|
|
24
|
+
type === 'default' ? styles.default : undefined,
|
|
25
|
+
type === 'title' ? styles.title : undefined,
|
|
26
|
+
type === 'defaultSemiBold' ? styles.defaultSemiBold : undefined,
|
|
27
|
+
type === 'subtitle' ? styles.subtitle : undefined,
|
|
28
|
+
type === 'link' ? styles.link : undefined,
|
|
29
29
|
style,
|
|
30
30
|
]}
|
|
31
31
|
{...rest}
|
|
@@ -41,20 +41,20 @@ const styles = StyleSheet.create({
|
|
|
41
41
|
defaultSemiBold: {
|
|
42
42
|
fontSize: 16,
|
|
43
43
|
lineHeight: 24,
|
|
44
|
-
fontWeight:
|
|
44
|
+
fontWeight: '600',
|
|
45
45
|
},
|
|
46
46
|
title: {
|
|
47
47
|
fontSize: 32,
|
|
48
|
-
fontWeight:
|
|
48
|
+
fontWeight: 'bold',
|
|
49
49
|
lineHeight: 32,
|
|
50
50
|
},
|
|
51
51
|
subtitle: {
|
|
52
52
|
fontSize: 20,
|
|
53
|
-
fontWeight:
|
|
53
|
+
fontWeight: 'bold',
|
|
54
54
|
},
|
|
55
55
|
link: {
|
|
56
56
|
lineHeight: 30,
|
|
57
57
|
fontSize: 16,
|
|
58
|
-
color:
|
|
58
|
+
color: '#0a7ea4',
|
|
59
59
|
},
|
|
60
60
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { View, type ViewProps } from
|
|
1
|
+
import { View, type ViewProps } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { useThemeColor } from
|
|
3
|
+
import { useThemeColor } from '@/hooks/use-theme-color';
|
|
4
4
|
|
|
5
5
|
export type ThemedViewProps = ViewProps & {
|
|
6
6
|
lightColor?: string;
|
|
@@ -8,7 +8,7 @@ export type ThemedViewProps = ViewProps & {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export function ThemedView({ style, lightColor, darkColor, ...otherProps }: ThemedViewProps) {
|
|
11
|
-
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor },
|
|
11
|
+
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background');
|
|
12
12
|
|
|
13
13
|
return <View style={[{ backgroundColor }, style]} {...otherProps} />;
|
|
14
14
|
}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { PropsWithChildren, useState } from
|
|
2
|
-
import { StyleSheet, TouchableOpacity } from
|
|
1
|
+
import { PropsWithChildren, useState } from 'react';
|
|
2
|
+
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { ThemedText } from
|
|
5
|
-
import { ThemedView } from
|
|
6
|
-
import { IconSymbol } from
|
|
7
|
-
import { Colors } from
|
|
8
|
-
import { useColorScheme } from
|
|
4
|
+
import { ThemedText } from '@/components/themed-text';
|
|
5
|
+
import { ThemedView } from '@/components/themed-view';
|
|
6
|
+
import { IconSymbol } from '@/components/ui/icon-symbol';
|
|
7
|
+
import { Colors } from '@/constants/theme';
|
|
8
|
+
import { useColorScheme } from '@/hooks/use-color-scheme';
|
|
9
9
|
|
|
10
10
|
export function Collapsible({ children, title }: PropsWithChildren & { title: string }) {
|
|
11
11
|
const [isOpen, setIsOpen] = useState(false);
|
|
12
|
-
const theme = useColorScheme() ??
|
|
12
|
+
const theme = useColorScheme() ?? 'light';
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<ThemedView>
|
|
16
16
|
<TouchableOpacity
|
|
17
17
|
style={styles.heading}
|
|
18
18
|
onPress={() => setIsOpen((value) => !value)}
|
|
19
|
-
activeOpacity={0.8}
|
|
20
|
-
>
|
|
19
|
+
activeOpacity={0.8}>
|
|
21
20
|
<IconSymbol
|
|
22
21
|
name="chevron.right"
|
|
23
22
|
size={18}
|
|
24
23
|
weight="medium"
|
|
25
|
-
color={theme ===
|
|
26
|
-
style={{ transform: [{ rotate: isOpen ?
|
|
24
|
+
color={theme === 'light' ? Colors.light.icon : Colors.dark.icon}
|
|
25
|
+
style={{ transform: [{ rotate: isOpen ? '90deg' : '0deg' }] }}
|
|
27
26
|
/>
|
|
28
27
|
|
|
29
28
|
<ThemedText type="defaultSemiBold">{title}</ThemedText>
|
|
@@ -35,8 +34,8 @@ export function Collapsible({ children, title }: PropsWithChildren & { title: st
|
|
|
35
34
|
|
|
36
35
|
const styles = StyleSheet.create({
|
|
37
36
|
heading: {
|
|
38
|
-
flexDirection:
|
|
39
|
-
alignItems:
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
alignItems: 'center',
|
|
40
39
|
gap: 6,
|
|
41
40
|
},
|
|
42
41
|
content: {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { SymbolView, SymbolViewProps, SymbolWeight } from
|
|
2
|
-
import { StyleProp, ViewStyle } from
|
|
1
|
+
import { SymbolView, SymbolViewProps, SymbolWeight } from 'expo-symbols';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export function IconSymbol({
|
|
5
5
|
name,
|
|
6
6
|
size = 24,
|
|
7
7
|
color,
|
|
8
8
|
style,
|
|
9
|
-
weight =
|
|
9
|
+
weight = 'regular',
|
|
10
10
|
}: {
|
|
11
|
-
name: SymbolViewProps[
|
|
11
|
+
name: SymbolViewProps['name'];
|
|
12
12
|
size?: number;
|
|
13
13
|
color: string;
|
|
14
14
|
style?: StyleProp<ViewStyle>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Fallback for using MaterialIcons on Android and web.
|
|
2
2
|
|
|
3
|
-
import MaterialIcons from
|
|
4
|
-
import { SymbolWeight, SymbolViewProps } from
|
|
5
|
-
import { ComponentProps } from
|
|
6
|
-
import { OpaqueColorValue, type StyleProp, type TextStyle } from
|
|
3
|
+
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
|
4
|
+
import { SymbolWeight, SymbolViewProps } from 'expo-symbols';
|
|
5
|
+
import { ComponentProps } from 'react';
|
|
6
|
+
import { OpaqueColorValue, type StyleProp, type TextStyle } from 'react-native';
|
|
7
7
|
|
|
8
|
-
type IconMapping = Record<SymbolViewProps[
|
|
8
|
+
type IconMapping = Record<SymbolViewProps['name'], ComponentProps<typeof MaterialIcons>['name']>;
|
|
9
9
|
type IconSymbolName = keyof typeof MAPPING;
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -14,10 +14,10 @@ type IconSymbolName = keyof typeof MAPPING;
|
|
|
14
14
|
* - see SF Symbols in the [SF Symbols](https://developer.apple.com/sf-symbols/) app.
|
|
15
15
|
*/
|
|
16
16
|
const MAPPING = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
'house.fill': 'home',
|
|
18
|
+
'paperplane.fill': 'send',
|
|
19
|
+
'chevron.left.forwardslash.chevron.right': 'code',
|
|
20
|
+
'chevron.right': 'chevron-right',
|
|
21
21
|
} as IconMapping;
|
|
22
22
|
|
|
23
23
|
/**
|