lucy-cli 2.0.0-alpha.3 → 2.0.0-alpha.4
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/dist/init.js +11 -8
- package/files/expo/components/.gitkeep +0 -0
- package/files/expo/components/ui/.gitkeep +0 -0
- package/files/expo/index.ts +11 -0
- package/files/expo/metro.config.js +10 -7
- package/package.json +1 -1
- package/src/init.ts +14 -7
- package/files/expo/app/(tabs)/_layout.tsx +0 -50
- package/files/expo/app/(tabs)/explore.tsx +0 -114
- package/files/expo/app/(tabs)/index.tsx +0 -80
- package/files/expo/app/+not-found.tsx +0 -37
- package/files/expo/app/_layout.tsx +0 -54
- package/files/expo/assets/images/partial-react-logo.png +0 -0
- package/files/expo/assets/images/react-logo.png +0 -0
- package/files/expo/assets/images/react-logo@2x.png +0 -0
- package/files/expo/assets/images/react-logo@3x.png +0 -0
- package/files/expo/components/Collapsible.tsx +0 -52
- package/files/expo/components/ExternalLink.tsx +0 -32
- package/files/expo/components/HapticTab.tsx +0 -24
- package/files/expo/components/HelloWave.tsx +0 -35
- package/files/expo/components/ParallaxScrollView.tsx +0 -85
- package/files/expo/components/ThemedText.tsx +0 -70
- package/files/expo/components/ThemedView.tsx +0 -23
- package/files/expo/components/ui/IconSymbol.ios.tsx +0 -32
- package/files/expo/components/ui/IconSymbol.tsx +0 -41
- package/files/expo/components/ui/TabBarBackground.ios.tsx +0 -19
- package/files/expo/components/ui/TabBarBackground.tsx +0 -6
- package/files/expo/constants/Colors.ts +0 -27
- package/files/expo/hooks/useColorScheme.web.ts +0 -24
- package/files/expo/hooks/useColorSchemeRN.ts +0 -1
- package/files/expo/hooks/useThemeColor.ts +0 -30
package/dist/init.js
CHANGED
@@ -166,13 +166,13 @@ const init_expo = () => {
|
|
166
166
|
const resolutions = {
|
167
167
|
"@wix/sdk@1.15.24": "patch:@wix/sdk@npm:1.15.24#./patches/@wix-sdk-npm-1.15.24-1adbec98e9.patch",
|
168
168
|
};
|
169
|
-
const yarn = Command.make("yarn", "add", "nativewind", "react-native-reanimated@~3.17.4", "react-native-safe-area-context@5.4.0", "@wix/sdk@1.15.24", "@wix/data", "expo-standard-web-crypto", "effect", "node-libs-react-native", "util", "events").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
169
|
+
const yarn = Command.make("yarn", "add", "nativewind", "react-native-reanimated@~3.17.4", "react-native-safe-area-context@5.4.0", "@wix/sdk@1.15.24", "@wix/data", "expo-standard-web-crypto", "effect", "node-libs-react-native", "util", "events", "tailwindcss-animate").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
170
170
|
Command.exitCode // Get the exit code
|
171
171
|
);
|
172
172
|
const yarnDev = Command.make("yarn", "add", "--dev", "tailwindcss@^3.4.17", "prettier-plugin-tailwindcss@^0.5.11", "@styled/typescript-styled-plugin", "typescript-eslint-language-service", "eslint-config-prettier", "eslint-plugin-jsdoc", "eslint-plugin-named-import-spacing", "eslint-plugin-only-warn", "eslint-plugin-react", "eslint-plugin-react-hooks", "eslint-plugin-simple-import-sort", "@next/eslint-plugin-next", "@styled/typescript-styled-plugin", "@stylelint/postcss-css-in-js", "@typescript-eslint/parser", "typescript-eslint", "typescript-eslint-language-service", "@total-typescript/ts-reset", "expo-doctor", "tsx").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
173
173
|
Command.exitCode // Get the exit code
|
174
174
|
);
|
175
|
-
const npx = Command.make("npx", "expo", "install", "tailwindcss-animate", "class-variance-authority", "clsx", "tailwind-merge", "expo-crypto").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
175
|
+
const npx = Command.make("npx", "expo", "install", "tailwindcss-animate", "class-variance-authority", "clsx", "tailwind-merge", "expo-crypto", "react-dom", "react-native-web", "@expo/metro-runtime", "expo-system-ui").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
176
176
|
Command.exitCode // Get the exit code
|
177
177
|
);
|
178
178
|
const projectName = config.config.cwd.split('/').pop() || 'expo-project';
|
@@ -194,7 +194,7 @@ const init_expo = () => {
|
|
194
194
|
if (nonGitFiles.length > 0)
|
195
195
|
return yield* Effect.logError("The current directory is not empty. Please run this command in an empty directory.");
|
196
196
|
if (!expoAppReady) {
|
197
|
-
const initExpo = Command.make("npx", "create-expo-app@latest", projectName).pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
197
|
+
const initExpo = Command.make("npx", "create-expo-app@latest", projectName, "--template", "blank-typescript", "--no-install").pipe(Command.stdout("inherit"), // Stream stdout to process.stdout
|
198
198
|
Command.exitCode // Get the exit code
|
199
199
|
);
|
200
200
|
yield* initExpo;
|
@@ -205,12 +205,12 @@ const init_expo = () => {
|
|
205
205
|
}
|
206
206
|
if (lucyInitialized)
|
207
207
|
return yield* Effect.logError("Lucy is already initialized in this project. Please run this command in an empty directory.");
|
208
|
-
console.log("Expo project initialized with app.json:", projectName);
|
209
208
|
const baseFiles = yield* fs.readDirectory(config.config.filesFolder + '/expo');
|
210
209
|
yield* Effect.forEach(baseFiles, (file) => fs.copy(path.join(config.config.filesFolder, 'expo', file), path.join(config.config.cwd, file), { overwrite: true }));
|
211
|
-
let res = yield*
|
212
|
-
res = yield* yarn;
|
210
|
+
let res = yield* yarn;
|
213
211
|
res = yield* yarnDev;
|
212
|
+
console.log("🐕 " + 'npx');
|
213
|
+
res = yield* npx;
|
214
214
|
if (res !== 0) {
|
215
215
|
return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
|
216
216
|
}
|
@@ -222,12 +222,15 @@ const init_expo = () => {
|
|
222
222
|
"web": "expo start --web",
|
223
223
|
"reset": "tsx ./scripts/reset-project.ts",
|
224
224
|
"format": "prettier --write \"./*.json\" \"**/*.{ts,tsx,md,json,jsonc,json5}\"",
|
225
|
+
"prebuild": "expo prebuild",
|
226
|
+
"pods": "npx pod-install",
|
225
227
|
"build:dev": "eas build --local --profile development",
|
226
|
-
"build:sim": "eas build --local --profile simulator",
|
228
|
+
"build:sim": "eas build --local --profile ios-simulator",
|
227
229
|
"build:prev": "eas build --local --profile preview",
|
228
230
|
"build:prod": "eas build --local --profile production",
|
229
231
|
"build:web": "expo export --platform web",
|
230
|
-
"doctor": "expo-doctor"
|
232
|
+
"doctor": "expo-doctor",
|
233
|
+
"eas-build-pre-install": "corepack enable && yarn set version 4"
|
231
234
|
};
|
232
235
|
const packageJsonPath = path.join(config.config.cwd, "package.json");
|
233
236
|
const packageJsonRaw = yield* fs.readFile(packageJsonPath);
|
File without changes
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import '@/global.css';
|
2
|
+
import '@/lib/utils/polyfills';
|
3
|
+
|
4
|
+
import { registerRootComponent } from 'expo';
|
5
|
+
|
6
|
+
import App from './App';
|
7
|
+
|
8
|
+
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
|
9
|
+
// It also ensures that whether you load the app in Expo Go or in a native build,
|
10
|
+
// the environment is set up appropriately
|
11
|
+
registerRootComponent(App);
|
@@ -13,19 +13,22 @@ const config = (() => {
|
|
13
13
|
config.resolver = {
|
14
14
|
...resolver,
|
15
15
|
};
|
16
|
+
|
17
|
+
config.resolver.unstable_enablePackageExports = false;
|
18
|
+
|
16
19
|
config.resolver.extraNodeModules = {
|
17
20
|
...config.resolver.extraNodeModules,
|
18
21
|
...require('node-libs-react-native'),
|
19
|
-
'node:buffer': require.resolve('buffer/'),
|
20
|
-
'node:crypto': require.resolve('react-native-crypto/'),
|
21
|
-
'node:util': require.resolve('util/'),
|
22
|
-
'node:http': require.resolve('stream-http/'),
|
23
|
-
'node:https': require.resolve('https-browserify/'),
|
24
|
-
'node:events': require.resolve('events/'),
|
22
|
+
// 'node:buffer': require.resolve('buffer/'),
|
23
|
+
// 'node:crypto': require.resolve('react-native-crypto/'),
|
24
|
+
// 'node:util': require.resolve('util/'),
|
25
|
+
// 'node:http': require.resolve('stream-http/'),
|
26
|
+
// 'node:https': require.resolve('https-browserify/'),
|
27
|
+
// 'node:events': require.resolve('events/'),
|
25
28
|
};
|
26
29
|
|
27
30
|
return config;
|
28
31
|
})();
|
29
|
-
|
32
|
+
console.log('Using Metro config:', JSON.stringify(config, null, 2));
|
30
33
|
module.exports = withNativeWind(config, { input: './global.css' });
|
31
34
|
|
package/package.json
CHANGED
package/src/init.ts
CHANGED
@@ -211,6 +211,7 @@ const init_expo = () => {
|
|
211
211
|
"node-libs-react-native",
|
212
212
|
"util",
|
213
213
|
"events",
|
214
|
+
"tailwindcss-animate",
|
214
215
|
).pipe(
|
215
216
|
Command.stdout("inherit"), // Stream stdout to process.stdout
|
216
217
|
Command.exitCode // Get the exit code
|
@@ -254,6 +255,10 @@ const init_expo = () => {
|
|
254
255
|
"clsx",
|
255
256
|
"tailwind-merge",
|
256
257
|
"expo-crypto",
|
258
|
+
"react-dom",
|
259
|
+
"react-native-web",
|
260
|
+
"@expo/metro-runtime",
|
261
|
+
"expo-system-ui"
|
257
262
|
).pipe(
|
258
263
|
Command.stdout("inherit"), // Stream stdout to process.stdout
|
259
264
|
Command.exitCode // Get the exit code
|
@@ -281,7 +286,7 @@ const init_expo = () => {
|
|
281
286
|
if(nonGitFiles.length > 0) return yield* Effect.logError("The current directory is not empty. Please run this command in an empty directory.");
|
282
287
|
|
283
288
|
if(!expoAppReady) {
|
284
|
-
const initExpo = Command.make("npx", "create-expo-app@latest", projectName).pipe(
|
289
|
+
const initExpo = Command.make("npx", "create-expo-app@latest", projectName, "--template", "blank-typescript", "--no-install").pipe(
|
285
290
|
Command.stdout("inherit"), // Stream stdout to process.stdout
|
286
291
|
Command.exitCode // Get the exit code
|
287
292
|
)
|
@@ -299,17 +304,16 @@ const init_expo = () => {
|
|
299
304
|
}
|
300
305
|
if(lucyInitialized) return yield* Effect.logError("Lucy is already initialized in this project. Please run this command in an empty directory.");
|
301
306
|
|
302
|
-
console.log("Expo project initialized with app.json:", projectName);
|
303
|
-
|
304
307
|
const baseFiles = yield* fs.readDirectory(config.config.filesFolder + '/expo')
|
305
308
|
yield* Effect.forEach(
|
306
309
|
baseFiles,
|
307
310
|
(file) => fs.copy(path.join(config.config.filesFolder, 'expo', file), path.join(config.config.cwd, file), { overwrite: true })
|
308
311
|
)
|
309
312
|
|
310
|
-
let res = yield*
|
311
|
-
res = yield* yarn
|
313
|
+
let res = yield* yarn
|
312
314
|
res = yield* yarnDev
|
315
|
+
console.log("🐕 " + 'npx');
|
316
|
+
res = yield* npx
|
313
317
|
|
314
318
|
if (res !== 0) {
|
315
319
|
return yield* Effect.logError("Failed to install Expo dependencies. Please check the error message above.");
|
@@ -323,12 +327,15 @@ const init_expo = () => {
|
|
323
327
|
"web": "expo start --web",
|
324
328
|
"reset": "tsx ./scripts/reset-project.ts",
|
325
329
|
"format": "prettier --write \"./*.json\" \"**/*.{ts,tsx,md,json,jsonc,json5}\"",
|
330
|
+
"prebuild": "expo prebuild",
|
331
|
+
"pods": "npx pod-install",
|
326
332
|
"build:dev": "eas build --local --profile development",
|
327
|
-
"build:sim": "eas build --local --profile simulator",
|
333
|
+
"build:sim": "eas build --local --profile ios-simulator",
|
328
334
|
"build:prev": "eas build --local --profile preview",
|
329
335
|
"build:prod": "eas build --local --profile production",
|
330
336
|
"build:web": "expo export --platform web",
|
331
|
-
"doctor": "expo-doctor"
|
337
|
+
"doctor": "expo-doctor",
|
338
|
+
"eas-build-pre-install": "corepack enable && yarn set version 4"
|
332
339
|
}
|
333
340
|
|
334
341
|
const packageJsonPath = path.join(config.config.cwd, "package.json")
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import { Tabs } from 'expo-router';
|
2
|
-
import React from 'react';
|
3
|
-
import { Platform } from 'react-native';
|
4
|
-
|
5
|
-
import { HapticTab } from '@/components/HapticTab';
|
6
|
-
import { IconSymbol } from '@/components/ui/IconSymbol';
|
7
|
-
import TabBarBackground from '@/components/ui/TabBarBackground.ios';
|
8
|
-
import { colors } from '@/constants/Colors';
|
9
|
-
import { useColorScheme } from '@/hooks/useColorSchemeRN';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Renders the tab layout for the application.
|
13
|
-
* This includes the home and explore tabs with haptic feedback on press.
|
14
|
-
* @returns The tab layout component.
|
15
|
-
*/
|
16
|
-
export default function TabLayout() {
|
17
|
-
const colorScheme = useColorScheme();
|
18
|
-
|
19
|
-
return (
|
20
|
-
<Tabs
|
21
|
-
screenOptions={{
|
22
|
-
tabBarActiveTintColor: colors[colorScheme ?? 'light'].tint,
|
23
|
-
headerShown: false,
|
24
|
-
tabBarButton: HapticTab,
|
25
|
-
tabBarBackground: TabBarBackground,
|
26
|
-
tabBarStyle: Platform.select({
|
27
|
-
ios: {
|
28
|
-
// Use a transparent background on iOS to show the blur effect
|
29
|
-
position: 'absolute',
|
30
|
-
},
|
31
|
-
default: {},
|
32
|
-
}),
|
33
|
-
}}>
|
34
|
-
<Tabs.Screen
|
35
|
-
name="index"
|
36
|
-
options={{
|
37
|
-
title: 'Home',
|
38
|
-
tabBarIcon: ({ color }) => <IconSymbol size={28} name="house.fill" color={color} />,
|
39
|
-
}}
|
40
|
-
/>
|
41
|
-
<Tabs.Screen
|
42
|
-
name="explore"
|
43
|
-
options={{
|
44
|
-
title: 'Explore',
|
45
|
-
tabBarIcon: ({ color }) => <IconSymbol size={28} name="paperplane.fill" color={color} />,
|
46
|
-
}}
|
47
|
-
/>
|
48
|
-
</Tabs>
|
49
|
-
);
|
50
|
-
}
|
@@ -1,114 +0,0 @@
|
|
1
|
-
import { Image } from 'expo-image';
|
2
|
-
import { Platform, StyleSheet } from 'react-native';
|
3
|
-
|
4
|
-
import { Collapsible } from '@/components/Collapsible';
|
5
|
-
import { ExternalLink } from '@/components/ExternalLink';
|
6
|
-
import ParallaxScrollView from '@/components/ParallaxScrollView';
|
7
|
-
import { ThemedText } from '@/components/ThemedText';
|
8
|
-
import { ThemedView } from '@/components/ThemedView';
|
9
|
-
import { IconSymbol } from '@/components/ui/IconSymbol';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Renders the Explore screen with various examples and explanations of features.
|
13
|
-
* @returns The Explore screen component.
|
14
|
-
*/
|
15
|
-
export default function TabTwoScreen() {
|
16
|
-
return (
|
17
|
-
<ParallaxScrollView
|
18
|
-
headerBackgroundColor={{ light: '#D0D0D0', dark: '#353636' }}
|
19
|
-
headerImage={
|
20
|
-
<IconSymbol
|
21
|
-
size={310}
|
22
|
-
color="#808080"
|
23
|
-
name="chevron.left.forwardslash.chevron.right"
|
24
|
-
style={styles.headerImage}
|
25
|
-
/>
|
26
|
-
}>
|
27
|
-
<ThemedView style={styles.titleContainer}>
|
28
|
-
<ThemedText type="title">Explore</ThemedText>
|
29
|
-
</ThemedView>
|
30
|
-
<ThemedText>This app includes example code to help you get started.</ThemedText>
|
31
|
-
<Collapsible title="File-based routing">
|
32
|
-
<ThemedText>
|
33
|
-
This app has two screens:{' '}
|
34
|
-
<ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> and{' '}
|
35
|
-
<ThemedText type="defaultSemiBold">app/(tabs)/explore.tsx</ThemedText>
|
36
|
-
</ThemedText>
|
37
|
-
<ThemedText>
|
38
|
-
The layout file in <ThemedText type="defaultSemiBold">app/(tabs)/_layout.tsx</ThemedText>{' '}
|
39
|
-
sets up the tab navigator.
|
40
|
-
</ThemedText>
|
41
|
-
<ExternalLink href="https://docs.expo.dev/router/introduction">
|
42
|
-
<ThemedText type="link">Learn more</ThemedText>
|
43
|
-
</ExternalLink>
|
44
|
-
</Collapsible>
|
45
|
-
<Collapsible title="Android, iOS, and web support">
|
46
|
-
<ThemedText>
|
47
|
-
You can open this project on Android, iOS, and the web. To open the web version, press{' '}
|
48
|
-
<ThemedText type="defaultSemiBold">w</ThemedText> in the terminal running this project.
|
49
|
-
</ThemedText>
|
50
|
-
</Collapsible>
|
51
|
-
<Collapsible title="Images">
|
52
|
-
<ThemedText>
|
53
|
-
For static images, you can use the <ThemedText type="defaultSemiBold">@2x</ThemedText> and{' '}
|
54
|
-
<ThemedText type="defaultSemiBold">@3x</ThemedText> suffixes to provide files for
|
55
|
-
different screen densities
|
56
|
-
</ThemedText>
|
57
|
-
<Image source={require('@/assets/images/react-logo.png')} style={{ alignSelf: 'center' }} />
|
58
|
-
<ExternalLink href="https://reactnative.dev/docs/images">
|
59
|
-
<ThemedText type="link">Learn more</ThemedText>
|
60
|
-
</ExternalLink>
|
61
|
-
</Collapsible>
|
62
|
-
<Collapsible title="Custom fonts">
|
63
|
-
<ThemedText>
|
64
|
-
Open <ThemedText type="defaultSemiBold">app/_layout.tsx</ThemedText> to see how to load{' '}
|
65
|
-
<ThemedText style={{ fontFamily: 'SpaceMono' }}>
|
66
|
-
custom fonts such as this one.
|
67
|
-
</ThemedText>
|
68
|
-
</ThemedText>
|
69
|
-
<ExternalLink href="https://docs.expo.dev/versions/latest/sdk/font">
|
70
|
-
<ThemedText type="link">Learn more</ThemedText>
|
71
|
-
</ExternalLink>
|
72
|
-
</Collapsible>
|
73
|
-
<Collapsible title="Light and dark mode components">
|
74
|
-
<ThemedText>
|
75
|
-
This template has light and dark mode support. The{' '}
|
76
|
-
<ThemedText type="defaultSemiBold">useColorScheme()</ThemedText> hook lets you inspect
|
77
|
-
what the user's current color scheme is, and so you can adjust UI colors accordingly.
|
78
|
-
</ThemedText>
|
79
|
-
<ExternalLink href="https://docs.expo.dev/develop/user-interface/color-themes/">
|
80
|
-
<ThemedText type="link">Learn more</ThemedText>
|
81
|
-
</ExternalLink>
|
82
|
-
</Collapsible>
|
83
|
-
<Collapsible title="Animations">
|
84
|
-
<ThemedText>
|
85
|
-
This template includes an example of an animated component. The{' '}
|
86
|
-
<ThemedText type="defaultSemiBold">components/HelloWave.tsx</ThemedText> component uses
|
87
|
-
the powerful <ThemedText type="defaultSemiBold">react-native-reanimated</ThemedText>{' '}
|
88
|
-
library to create a waving hand animation.
|
89
|
-
</ThemedText>
|
90
|
-
{Platform.select({
|
91
|
-
ios: (
|
92
|
-
<ThemedText>
|
93
|
-
The <ThemedText type="defaultSemiBold">components/ParallaxScrollView.tsx</ThemedText>{' '}
|
94
|
-
component provides a parallax effect for the header image.
|
95
|
-
</ThemedText>
|
96
|
-
),
|
97
|
-
})}
|
98
|
-
</Collapsible>
|
99
|
-
</ParallaxScrollView>
|
100
|
-
);
|
101
|
-
}
|
102
|
-
|
103
|
-
const styles = StyleSheet.create({
|
104
|
-
headerImage: {
|
105
|
-
color: '#808080',
|
106
|
-
bottom: -90,
|
107
|
-
left: -35,
|
108
|
-
position: 'absolute',
|
109
|
-
},
|
110
|
-
titleContainer: {
|
111
|
-
flexDirection: 'row',
|
112
|
-
gap: 8,
|
113
|
-
},
|
114
|
-
});
|
@@ -1,80 +0,0 @@
|
|
1
|
-
import { Image } from 'expo-image';
|
2
|
-
import { Platform, StyleSheet } from 'react-native';
|
3
|
-
|
4
|
-
import { HelloWave } from '@/components/HelloWave';
|
5
|
-
import ParallaxScrollView from '@/components/ParallaxScrollView';
|
6
|
-
import { ThemedText } from '@/components/ThemedText';
|
7
|
-
import { ThemedView } from '@/components/ThemedView';
|
8
|
-
|
9
|
-
/**
|
10
|
-
* Home screen component.
|
11
|
-
* This screen serves as the landing page for the app,
|
12
|
-
* @returns The home screen component.
|
13
|
-
*/
|
14
|
-
export default function HomeScreen() {
|
15
|
-
return (
|
16
|
-
<ParallaxScrollView
|
17
|
-
headerBackgroundColor={{ light: '#A1CEDC', dark: '#1D3D47' }}
|
18
|
-
headerImage={
|
19
|
-
<Image
|
20
|
-
source={require('@/assets/images/partial-react-logo.png')}
|
21
|
-
style={styles.reactLogo}
|
22
|
-
/>
|
23
|
-
}>
|
24
|
-
<ThemedView style={styles.titleContainer}>
|
25
|
-
<ThemedText type="title">Welcome!</ThemedText>
|
26
|
-
<HelloWave />
|
27
|
-
</ThemedView>
|
28
|
-
<ThemedView style={styles.stepContainer}>
|
29
|
-
<ThemedText type="subtitle">Step 1: Try it</ThemedText>
|
30
|
-
<ThemedText>
|
31
|
-
Edit <ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> to see changes.
|
32
|
-
Press{' '}
|
33
|
-
<ThemedText type="defaultSemiBold">
|
34
|
-
{Platform.select({
|
35
|
-
ios: 'cmd + d',
|
36
|
-
android: 'cmd + m',
|
37
|
-
web: 'F12',
|
38
|
-
})}
|
39
|
-
</ThemedText>{' '}
|
40
|
-
to open developer tools.
|
41
|
-
</ThemedText>
|
42
|
-
</ThemedView>
|
43
|
-
<ThemedView style={styles.stepContainer}>
|
44
|
-
<ThemedText type="subtitle">Step 2: Explore</ThemedText>
|
45
|
-
<ThemedText>
|
46
|
-
{`Tap the Explore tab to learn more about what's included in this starter app.`}
|
47
|
-
</ThemedText>
|
48
|
-
</ThemedView>
|
49
|
-
<ThemedView style={styles.stepContainer}>
|
50
|
-
<ThemedText type="subtitle">Step 3: Get a fresh start</ThemedText>
|
51
|
-
<ThemedText>
|
52
|
-
{`When you're ready, run `}
|
53
|
-
<ThemedText type="defaultSemiBold">yarn reset-project</ThemedText> to get a fresh{' '}
|
54
|
-
<ThemedText type="defaultSemiBold">app</ThemedText> directory. This will move the current{' '}
|
55
|
-
<ThemedText type="defaultSemiBold">app</ThemedText> to{' '}
|
56
|
-
<ThemedText type="defaultSemiBold">app-example</ThemedText>.
|
57
|
-
</ThemedText>
|
58
|
-
</ThemedView>
|
59
|
-
</ParallaxScrollView>
|
60
|
-
);
|
61
|
-
}
|
62
|
-
|
63
|
-
const styles = StyleSheet.create({
|
64
|
-
titleContainer: {
|
65
|
-
flexDirection: 'row',
|
66
|
-
alignItems: 'center',
|
67
|
-
gap: 8,
|
68
|
-
},
|
69
|
-
stepContainer: {
|
70
|
-
gap: 8,
|
71
|
-
marginBottom: 8,
|
72
|
-
},
|
73
|
-
reactLogo: {
|
74
|
-
height: 178,
|
75
|
-
width: 290,
|
76
|
-
bottom: 0,
|
77
|
-
left: 0,
|
78
|
-
position: 'absolute',
|
79
|
-
},
|
80
|
-
});
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { Link, Stack } from 'expo-router';
|
2
|
-
import { StyleSheet } from 'react-native';
|
3
|
-
|
4
|
-
import { ThemedText } from '@/components/ThemedText';
|
5
|
-
import { ThemedView } from '@/components/ThemedView';
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Renders a not found screen when a route does not exist.
|
9
|
-
* This screen provides a link to navigate back to the home screen.
|
10
|
-
* @returns The not found screen component.
|
11
|
-
*/
|
12
|
-
export default function NotFoundScreen() {
|
13
|
-
return (
|
14
|
-
<>
|
15
|
-
<Stack.Screen options={{ title: 'Oops!' }} />
|
16
|
-
<ThemedView style={styles.container}>
|
17
|
-
<ThemedText type="title">This screen does not exist.</ThemedText>
|
18
|
-
<Link href="/" style={styles.link}>
|
19
|
-
<ThemedText type="link">Go to home screen!</ThemedText>
|
20
|
-
</Link>
|
21
|
-
</ThemedView>
|
22
|
-
</>
|
23
|
-
);
|
24
|
-
}
|
25
|
-
|
26
|
-
const styles = StyleSheet.create({
|
27
|
-
container: {
|
28
|
-
flex: 1,
|
29
|
-
alignItems: 'center',
|
30
|
-
justifyContent: 'center',
|
31
|
-
padding: 20,
|
32
|
-
},
|
33
|
-
link: {
|
34
|
-
marginTop: 15,
|
35
|
-
paddingVertical: 15,
|
36
|
-
},
|
37
|
-
});
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import '@/global.css';
|
2
|
-
import '@/lib/utils/polyfills';
|
3
|
-
|
4
|
-
import { DarkTheme, DefaultTheme, Theme, ThemeProvider } from '@react-navigation/native';
|
5
|
-
import { Stack } from 'expo-router';
|
6
|
-
import { StatusBar } from 'expo-status-bar';
|
7
|
-
import * as React from 'react';
|
8
|
-
import { Platform } from 'react-native';
|
9
|
-
|
10
|
-
import { NAV_THEME } from '@/constants/theme';
|
11
|
-
import { useColorScheme } from '@/hooks/useColorScheme';
|
12
|
-
|
13
|
-
const LIGHT_THEME: Theme = {
|
14
|
-
...DefaultTheme,
|
15
|
-
colors: NAV_THEME.light,
|
16
|
-
};
|
17
|
-
const DARK_THEME: Theme = {
|
18
|
-
...DarkTheme,
|
19
|
-
colors: NAV_THEME.dark,
|
20
|
-
};
|
21
|
-
export { ErrorBoundary } from 'expo-router';
|
22
|
-
/**
|
23
|
-
* Root layout component for the application.
|
24
|
-
* This component sets up the theme provider and status bar style based on the user's color scheme preference
|
25
|
-
* @returns The root layout component.
|
26
|
-
*/
|
27
|
-
export default function RootLayout() {
|
28
|
-
const hasMounted = React.useRef(false);
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
30
|
-
const { colorScheme, isDarkColorScheme } = useColorScheme();
|
31
|
-
const [isColorSchemeLoaded, setIsColorSchemeLoaded] = React.useState(false);
|
32
|
-
useIsomorphicLayoutEffect(() => {
|
33
|
-
if (hasMounted.current) {
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
if (Platform.OS === 'web') {
|
37
|
-
// Adds the background color to the html element to prevent white background on overscroll.
|
38
|
-
document.documentElement.classList.add('bg-background');
|
39
|
-
}
|
40
|
-
setIsColorSchemeLoaded(true);
|
41
|
-
hasMounted.current = true;
|
42
|
-
}, []);
|
43
|
-
if (!isColorSchemeLoaded) {
|
44
|
-
return null;
|
45
|
-
}
|
46
|
-
|
47
|
-
return (
|
48
|
-
<ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
|
49
|
-
<StatusBar style={isDarkColorScheme ? 'light' : 'dark'} />
|
50
|
-
<Stack />
|
51
|
-
</ThemeProvider>
|
52
|
-
);
|
53
|
-
}
|
54
|
-
const useIsomorphicLayoutEffect = Platform.OS === 'web' && typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import { PropsWithChildren, useState } from 'react';
|
2
|
-
import { StyleSheet, TouchableOpacity } from 'react-native';
|
3
|
-
|
4
|
-
import { ThemedText } from '@/components/ThemedText';
|
5
|
-
import { ThemedView } from '@/components/ThemedView';
|
6
|
-
import { IconSymbol } from '@/components/ui/IconSymbol';
|
7
|
-
import { colors } from '@/constants/Colors';
|
8
|
-
import { useColorScheme } from '@/hooks/useColorScheme';
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Renders a collapsible section with a heading and content.
|
12
|
-
* @param root0 - The props for the collapsible component.
|
13
|
-
* @param root0.children - The content to display when the section is expanded.
|
14
|
-
* @param root0.title - The title of the collapsible section.
|
15
|
-
* @returns The collapsible component.
|
16
|
-
*/
|
17
|
-
export function Collapsible({ children, title }: PropsWithChildren & { title: string }) {
|
18
|
-
const [isOpen, setIsOpen] = useState(false);
|
19
|
-
const theme = useColorScheme() ?? 'light';
|
20
|
-
|
21
|
-
return (
|
22
|
-
<ThemedView>
|
23
|
-
<TouchableOpacity
|
24
|
-
style={styles.heading}
|
25
|
-
onPress={() => setIsOpen((value) => !value)}
|
26
|
-
activeOpacity={0.8}>
|
27
|
-
<IconSymbol
|
28
|
-
name="chevron.right"
|
29
|
-
size={18}
|
30
|
-
weight="medium"
|
31
|
-
color={theme === 'light' ? colors.light.icon : colors.dark.icon}
|
32
|
-
style={{ transform: [{ rotate: isOpen ? '90deg' : '0deg' }] }}
|
33
|
-
/>
|
34
|
-
|
35
|
-
<ThemedText type="defaultSemiBold">{title}</ThemedText>
|
36
|
-
</TouchableOpacity>
|
37
|
-
{isOpen && <ThemedView style={styles.content}>{children}</ThemedView>}
|
38
|
-
</ThemedView>
|
39
|
-
);
|
40
|
-
}
|
41
|
-
|
42
|
-
const styles = StyleSheet.create({
|
43
|
-
heading: {
|
44
|
-
flexDirection: 'row',
|
45
|
-
alignItems: 'center',
|
46
|
-
gap: 6,
|
47
|
-
},
|
48
|
-
content: {
|
49
|
-
marginTop: 6,
|
50
|
-
marginLeft: 24,
|
51
|
-
},
|
52
|
-
});
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { Href, Link } from 'expo-router';
|
2
|
-
import { openBrowserAsync } from 'expo-web-browser';
|
3
|
-
import { type ComponentProps } from 'react';
|
4
|
-
import { Platform } from 'react-native';
|
5
|
-
|
6
|
-
type Props = Omit<ComponentProps<typeof Link>, 'href'> & { href: Href & string };
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Renders an external link that opens in an in-app browser on native platforms.
|
10
|
-
* @param root0 - The props for the external link component.
|
11
|
-
* @param root0.href - The URL to link to.
|
12
|
-
* @param root0.rest - Additional props for the link component.
|
13
|
-
* @returns The external link component.
|
14
|
-
*/
|
15
|
-
export function ExternalLink({ href, ...rest }: Props) {
|
16
|
-
return (
|
17
|
-
<Link
|
18
|
-
target="_blank"
|
19
|
-
{...rest}
|
20
|
-
href={href}
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
22
|
-
onPress={async (event) => {
|
23
|
-
if (Platform.OS !== 'web') {
|
24
|
-
// Prevent the default behavior of linking to the default browser on native.
|
25
|
-
event.preventDefault();
|
26
|
-
// Open the link in an in-app browser.
|
27
|
-
await openBrowserAsync(href);
|
28
|
-
}
|
29
|
-
}}
|
30
|
-
/>
|
31
|
-
);
|
32
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { BottomTabBarButtonProps } from '@react-navigation/bottom-tabs';
|
2
|
-
import { PlatformPressable } from '@react-navigation/elements';
|
3
|
-
import * as Haptics from 'expo-haptics';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Renders a tab button with haptic feedback on press.
|
7
|
-
* @param props - The props for the tab button.
|
8
|
-
* @returns The tab button component with haptic feedback.
|
9
|
-
*/
|
10
|
-
export function HapticTab(props: BottomTabBarButtonProps) {
|
11
|
-
return (
|
12
|
-
<PlatformPressable
|
13
|
-
{...props}
|
14
|
-
onPressIn={(ev) => {
|
15
|
-
if (process.env.EXPO_OS === 'ios') {
|
16
|
-
// Add a soft haptic feedback when pressing down on the tabs.
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
18
|
-
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
19
|
-
}
|
20
|
-
props.onPressIn?.(ev);
|
21
|
-
}}
|
22
|
-
/>
|
23
|
-
);
|
24
|
-
}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import { useEffect } from 'react';
|
2
|
-
import { StyleSheet } from 'react-native';
|
3
|
-
import Animated, { useAnimatedStyle, useSharedValue, withRepeat, withSequence, withTiming } from 'react-native-reanimated';
|
4
|
-
|
5
|
-
import { ThemedText } from '@/components/ThemedText';
|
6
|
-
|
7
|
-
/** Renders an animated waving hand emoji. */
|
8
|
-
export function HelloWave() {
|
9
|
-
const rotationAnimation = useSharedValue(0);
|
10
|
-
|
11
|
-
useEffect(() => {
|
12
|
-
rotationAnimation.value = withRepeat(
|
13
|
-
withSequence(withTiming(25, { duration: 150 }), withTiming(0, { duration: 150 })),
|
14
|
-
4 // Run the animation 4 times
|
15
|
-
);
|
16
|
-
}, [rotationAnimation]);
|
17
|
-
|
18
|
-
const animatedStyle = useAnimatedStyle(() => ({
|
19
|
-
transform: [{ rotate: `${rotationAnimation.value}deg` }],
|
20
|
-
}));
|
21
|
-
|
22
|
-
return (
|
23
|
-
<Animated.View style={animatedStyle}>
|
24
|
-
<ThemedText style={styles.text}>👋</ThemedText>
|
25
|
-
</Animated.View>
|
26
|
-
);
|
27
|
-
}
|
28
|
-
|
29
|
-
const styles = StyleSheet.create({
|
30
|
-
text: {
|
31
|
-
fontSize: 28,
|
32
|
-
lineHeight: 32,
|
33
|
-
marginTop: -6,
|
34
|
-
},
|
35
|
-
});
|
@@ -1,85 +0,0 @@
|
|
1
|
-
import type { PropsWithChildren, ReactElement } from 'react';
|
2
|
-
import { StyleSheet } from 'react-native';
|
3
|
-
import Animated, { interpolate, useAnimatedRef, useAnimatedStyle, useScrollViewOffset } from 'react-native-reanimated';
|
4
|
-
|
5
|
-
import { ThemedView } from '@/components/ThemedView';
|
6
|
-
import { useBottomTabOverflow } from '@/components/ui/TabBarBackground';
|
7
|
-
import { useColorScheme } from '@/hooks/useColorScheme';
|
8
|
-
|
9
|
-
const HEADER_HEIGHT = 250;
|
10
|
-
|
11
|
-
type Props = PropsWithChildren<{
|
12
|
-
headerImage: ReactElement;
|
13
|
-
headerBackgroundColor: { dark: string; light: string };
|
14
|
-
}>;
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Renders a parallax scroll view with a header image and background color.
|
18
|
-
* @param root0 - The props for the ParallaxScrollView component.
|
19
|
-
* @param root0.children - The content to display within the scroll view.
|
20
|
-
* @param root0.headerImage - The image to display in the header, which will have a parallax effect.
|
21
|
-
* @param root0.headerBackgroundColor - The background color for the header, which changes based on the color scheme.
|
22
|
-
* @returns The ParallaxScrollView component.
|
23
|
-
*/
|
24
|
-
export default function ParallaxScrollView({
|
25
|
-
children,
|
26
|
-
headerImage,
|
27
|
-
headerBackgroundColor,
|
28
|
-
}: Props) {
|
29
|
-
const colorScheme = useColorScheme() ?? 'light';
|
30
|
-
const scrollRef = useAnimatedRef<Animated.ScrollView>();
|
31
|
-
const scrollOffset = useScrollViewOffset(scrollRef);
|
32
|
-
const bottom = useBottomTabOverflow();
|
33
|
-
const headerAnimatedStyle = useAnimatedStyle(() => {
|
34
|
-
return {
|
35
|
-
transform: [
|
36
|
-
{
|
37
|
-
translateY: interpolate(
|
38
|
-
scrollOffset.value,
|
39
|
-
[-HEADER_HEIGHT, 0, HEADER_HEIGHT],
|
40
|
-
[-HEADER_HEIGHT / 2, 0, HEADER_HEIGHT * 0.75]
|
41
|
-
),
|
42
|
-
},
|
43
|
-
{
|
44
|
-
scale: interpolate(scrollOffset.value, [-HEADER_HEIGHT, 0, HEADER_HEIGHT], [2, 1, 1]),
|
45
|
-
},
|
46
|
-
],
|
47
|
-
};
|
48
|
-
});
|
49
|
-
|
50
|
-
return (
|
51
|
-
<ThemedView style={styles.container}>
|
52
|
-
<Animated.ScrollView
|
53
|
-
ref={scrollRef}
|
54
|
-
scrollEventThrottle={16}
|
55
|
-
scrollIndicatorInsets={{ bottom }}
|
56
|
-
contentContainerStyle={{ paddingBottom: bottom }}>
|
57
|
-
<Animated.View
|
58
|
-
style={[
|
59
|
-
styles.header,
|
60
|
-
{ backgroundColor: headerBackgroundColor[colorScheme] },
|
61
|
-
headerAnimatedStyle,
|
62
|
-
]}>
|
63
|
-
{headerImage}
|
64
|
-
</Animated.View>
|
65
|
-
<ThemedView style={styles.content}>{children}</ThemedView>
|
66
|
-
</Animated.ScrollView>
|
67
|
-
</ThemedView>
|
68
|
-
);
|
69
|
-
}
|
70
|
-
|
71
|
-
const styles = StyleSheet.create({
|
72
|
-
container: {
|
73
|
-
flex: 1,
|
74
|
-
},
|
75
|
-
header: {
|
76
|
-
height: HEADER_HEIGHT,
|
77
|
-
overflow: 'hidden',
|
78
|
-
},
|
79
|
-
content: {
|
80
|
-
flex: 1,
|
81
|
-
padding: 32,
|
82
|
-
gap: 16,
|
83
|
-
overflow: 'hidden',
|
84
|
-
},
|
85
|
-
});
|
@@ -1,70 +0,0 @@
|
|
1
|
-
import { StyleSheet, Text, type TextProps } from 'react-native';
|
2
|
-
|
3
|
-
import { useThemeColor } from '@/hooks/useThemeColor';
|
4
|
-
|
5
|
-
export type ThemedTextProps = TextProps & {
|
6
|
-
lightColor?: string;
|
7
|
-
darkColor?: string;
|
8
|
-
type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link';
|
9
|
-
};
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Renders themed text with different styles based on the type and color scheme.
|
13
|
-
* @param root0 - The props for the themed text component.
|
14
|
-
* @param root0.style - Additional styles to apply to the text.
|
15
|
-
* @param root0.lightColor - The color to use in light mode.
|
16
|
-
* @param root0.darkColor - The color to use in dark mode.
|
17
|
-
* @param root0.type - The type of text to render, which determines the style.
|
18
|
-
* @param root0.rest - Additional props for the text component.
|
19
|
-
* @returns The themed text component.
|
20
|
-
*/
|
21
|
-
export function ThemedText({
|
22
|
-
style,
|
23
|
-
lightColor,
|
24
|
-
darkColor,
|
25
|
-
type = 'default',
|
26
|
-
...rest
|
27
|
-
}: ThemedTextProps) {
|
28
|
-
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text');
|
29
|
-
|
30
|
-
return (
|
31
|
-
<Text
|
32
|
-
style={[
|
33
|
-
{ color },
|
34
|
-
type === 'default' ? styles.default : undefined,
|
35
|
-
type === 'title' ? styles.title : undefined,
|
36
|
-
type === 'defaultSemiBold' ? styles.defaultSemiBold : undefined,
|
37
|
-
type === 'subtitle' ? styles.subtitle : undefined,
|
38
|
-
type === 'link' ? styles.link : undefined,
|
39
|
-
style,
|
40
|
-
]}
|
41
|
-
{...rest}
|
42
|
-
/>
|
43
|
-
);
|
44
|
-
}
|
45
|
-
|
46
|
-
const styles = StyleSheet.create({
|
47
|
-
default: {
|
48
|
-
fontSize: 16,
|
49
|
-
lineHeight: 24,
|
50
|
-
},
|
51
|
-
defaultSemiBold: {
|
52
|
-
fontSize: 16,
|
53
|
-
lineHeight: 24,
|
54
|
-
fontWeight: '600',
|
55
|
-
},
|
56
|
-
title: {
|
57
|
-
fontSize: 32,
|
58
|
-
fontWeight: 'bold',
|
59
|
-
lineHeight: 32,
|
60
|
-
},
|
61
|
-
subtitle: {
|
62
|
-
fontSize: 20,
|
63
|
-
fontWeight: 'bold',
|
64
|
-
},
|
65
|
-
link: {
|
66
|
-
lineHeight: 30,
|
67
|
-
fontSize: 16,
|
68
|
-
color: '#0a7ea4',
|
69
|
-
},
|
70
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { View, type ViewProps } from 'react-native';
|
2
|
-
|
3
|
-
import { useThemeColor } from '@/hooks/useThemeColor';
|
4
|
-
|
5
|
-
export type ThemedViewProps = ViewProps & {
|
6
|
-
lightColor?: string;
|
7
|
-
darkColor?: string;
|
8
|
-
};
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Renders a themed view with a background color based on the color scheme.
|
12
|
-
* @param root0 - The props for the themed view component.
|
13
|
-
* @param root0.style - Additional styles to apply to the view.
|
14
|
-
* @param root0.lightColor - The color to use in light mode.
|
15
|
-
* @param root0.darkColor - The color to use in dark mode.
|
16
|
-
* @param root0.rest - Additional props for the view component.
|
17
|
-
* @returns The themed view component.
|
18
|
-
*/
|
19
|
-
export function ThemedView({ style, lightColor, darkColor, ...otherProps }: ThemedViewProps) {
|
20
|
-
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background');
|
21
|
-
|
22
|
-
return <View style={[{ backgroundColor }, style]} {...otherProps} />;
|
23
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { SymbolView, SymbolViewProps, SymbolWeight } from 'expo-symbols';
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
3
|
-
|
4
|
-
export function IconSymbol({
|
5
|
-
name,
|
6
|
-
size = 24,
|
7
|
-
color,
|
8
|
-
style,
|
9
|
-
weight = 'regular',
|
10
|
-
}: {
|
11
|
-
name: SymbolViewProps['name'];
|
12
|
-
size?: number;
|
13
|
-
color: string;
|
14
|
-
style?: StyleProp<ViewStyle>;
|
15
|
-
weight?: SymbolWeight;
|
16
|
-
}) {
|
17
|
-
return (
|
18
|
-
<SymbolView
|
19
|
-
weight={weight}
|
20
|
-
tintColor={color}
|
21
|
-
resizeMode="scaleAspectFit"
|
22
|
-
name={name}
|
23
|
-
style={[
|
24
|
-
{
|
25
|
-
width: size,
|
26
|
-
height: size,
|
27
|
-
},
|
28
|
-
style,
|
29
|
-
]}
|
30
|
-
/>
|
31
|
-
);
|
32
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
// Fallback for using MaterialIcons on Android and web.
|
2
|
-
|
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
|
-
|
8
|
-
type IconMapping = Record<SymbolViewProps['name'], ComponentProps<typeof MaterialIcons>['name']>;
|
9
|
-
type IconSymbolName = keyof typeof MAPPING;
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Add your SF Symbols to Material Icons mappings here.
|
13
|
-
* - see Material Icons in the [Icons Directory](https://icons.expo.fyi).
|
14
|
-
* - see SF Symbols in the [SF Symbols](https://developer.apple.com/sf-symbols/) app.
|
15
|
-
*/
|
16
|
-
const MAPPING = {
|
17
|
-
'house.fill': 'home',
|
18
|
-
'paperplane.fill': 'send',
|
19
|
-
'chevron.left.forwardslash.chevron.right': 'code',
|
20
|
-
'chevron.right': 'chevron-right',
|
21
|
-
} as IconMapping;
|
22
|
-
|
23
|
-
/**
|
24
|
-
* An icon component that uses native SF Symbols on iOS, and Material Icons on Android and web.
|
25
|
-
* This ensures a consistent look across platforms, and optimal resource usage.
|
26
|
-
* Icon `name`s are based on SF Symbols and require manual mapping to Material Icons.
|
27
|
-
*/
|
28
|
-
export function IconSymbol({
|
29
|
-
name,
|
30
|
-
size = 24,
|
31
|
-
color,
|
32
|
-
style,
|
33
|
-
}: {
|
34
|
-
name: IconSymbolName;
|
35
|
-
size?: number;
|
36
|
-
color: string | OpaqueColorValue;
|
37
|
-
style?: StyleProp<TextStyle>;
|
38
|
-
weight?: SymbolWeight;
|
39
|
-
}) {
|
40
|
-
return <MaterialIcons color={color} size={size} name={MAPPING[name]} style={style} />;
|
41
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { useBottomTabBarHeight } from '@react-navigation/bottom-tabs';
|
2
|
-
import { BlurView } from 'expo-blur';
|
3
|
-
import { StyleSheet } from 'react-native';
|
4
|
-
|
5
|
-
export default function BlurTabBarBackground() {
|
6
|
-
return (
|
7
|
-
<BlurView
|
8
|
-
// System chrome material automatically adapts to the system's theme
|
9
|
-
// and matches the native tab bar appearance on iOS.
|
10
|
-
tint="systemChromeMaterial"
|
11
|
-
intensity={100}
|
12
|
-
style={StyleSheet.absoluteFill}
|
13
|
-
/>
|
14
|
-
);
|
15
|
-
}
|
16
|
-
|
17
|
-
export function useBottomTabOverflow() {
|
18
|
-
return useBottomTabBarHeight();
|
19
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Below are the colors that are used in the app. The colors are defined in the light and dark mode.
|
3
|
-
* There are many other ways to style your app. For example, [Nativewind](https://www.nativewind.dev/), [Tamagui](https://tamagui.dev/), [unistyles](https://reactnativeunistyles.vercel.app), etc.
|
4
|
-
*/
|
5
|
-
|
6
|
-
const tintColorLight = '#0a7ea4';
|
7
|
-
const tintColorDark = '#fff';
|
8
|
-
|
9
|
-
export const colors = {
|
10
|
-
light: {
|
11
|
-
text: '#11181C',
|
12
|
-
background: '#fff',
|
13
|
-
tint: tintColorLight,
|
14
|
-
icon: '#687076',
|
15
|
-
tabIconDefault: '#687076',
|
16
|
-
tabIconSelected: tintColorLight,
|
17
|
-
},
|
18
|
-
dark: {
|
19
|
-
text: '#ECEDEE',
|
20
|
-
background: '#151718',
|
21
|
-
tint: tintColorDark,
|
22
|
-
icon: '#9BA1A6',
|
23
|
-
tabIconDefault: '#9BA1A6',
|
24
|
-
tabIconSelected: tintColorDark,
|
25
|
-
},
|
26
|
-
};
|
27
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import { useColorScheme as useRNColorScheme } from 'react-native';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* To support static rendering, this value needs to be re-calculated on the client side for web
|
6
|
-
* This hook returns the color scheme after the component has mounted, ensuring that the initial render
|
7
|
-
* does not depend on the color scheme.
|
8
|
-
* @returns The current color scheme ('light' or 'dark') after hydration.
|
9
|
-
*/
|
10
|
-
export function useColorScheme() {
|
11
|
-
const [hasHydrated, setHasHydrated] = useState(false);
|
12
|
-
|
13
|
-
useEffect(() => {
|
14
|
-
setHasHydrated(true);
|
15
|
-
}, []);
|
16
|
-
|
17
|
-
const colorScheme = useRNColorScheme();
|
18
|
-
|
19
|
-
if (hasHydrated) {
|
20
|
-
return colorScheme;
|
21
|
-
}
|
22
|
-
|
23
|
-
return 'light';
|
24
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export { useColorScheme } from 'react-native';
|
@@ -1,30 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Learn more about light and dark modes:
|
3
|
-
* https://docs.expo.dev/guides/color-schemes/
|
4
|
-
*/
|
5
|
-
|
6
|
-
import { colors } from '@/constants/Colors';
|
7
|
-
|
8
|
-
import { useColorScheme } from './useColorSchemeRN';
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Returns the theme color based on the current color scheme and the provided color name.
|
12
|
-
* @param props - An object containing light and dark color properties.
|
13
|
-
* @param props.light - The color to use in light mode.
|
14
|
-
* @param props.dark - The color to use in dark mode.
|
15
|
-
* @param colorName - The name of the color to retrieve from the colors object.
|
16
|
-
* @returns The color corresponding to the current color scheme.
|
17
|
-
*/
|
18
|
-
export function useThemeColor(
|
19
|
-
props: { light?: string; dark?: string },
|
20
|
-
colorName: keyof typeof colors.light
|
21
|
-
) {
|
22
|
-
const theme = useColorScheme() ?? 'light';
|
23
|
-
const colorFromProps = props[theme];
|
24
|
-
|
25
|
-
if (colorFromProps) {
|
26
|
-
return colorFromProps;
|
27
|
-
} else {
|
28
|
-
return colors[theme][colorName];
|
29
|
-
}
|
30
|
-
}
|