create-expo-stack 2.4.3 → 2.5.0-next.160eed8

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.
Files changed (80) hide show
  1. package/README.md +4 -4
  2. package/build/commands/create-expo-stack.js +12 -4
  3. package/build/templates/base/App.tsx.ejs +51 -91
  4. package/build/templates/base/app.json.ejs +6 -0
  5. package/build/templates/base/components/BackButton.tsx.ejs +23 -0
  6. package/build/templates/base/components/Button.tsx.ejs +40 -0
  7. package/build/templates/base/components/EditScreenInfo.tsx.ejs +55 -0
  8. package/build/templates/base/components/HeaderButton.tsx.ejs +28 -0
  9. package/build/templates/base/components/ScreenContent.tsx.ejs +38 -0
  10. package/build/templates/base/components/TabBarIcon.tsx.ejs +15 -0
  11. package/build/templates/base/package.json.ejs +16 -6
  12. package/build/templates/base/prettier.config.js.ejs +11 -0
  13. package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/_layout.tsx.ejs +1 -13
  14. package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/index.tsx.ejs +18 -84
  15. package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/two.tsx.ejs +18 -84
  16. package/build/templates/packages/expo-router/drawer/app/(drawer)/_layout.tsx.ejs +4 -18
  17. package/build/templates/packages/expo-router/drawer/app/(drawer)/index.tsx.ejs +12 -80
  18. package/build/templates/packages/expo-router/drawer/app/_layout.tsx.ejs +4 -0
  19. package/build/templates/packages/expo-router/drawer/app/modal.tsx.ejs +16 -92
  20. package/build/templates/packages/expo-router/stack/app/_layout.tsx.ejs +3 -0
  21. package/build/templates/packages/expo-router/stack/app/details.tsx.ejs +17 -171
  22. package/build/templates/packages/expo-router/stack/app/index.tsx.ejs +23 -187
  23. package/build/templates/packages/expo-router/tabs/app/(tabs)/_layout.tsx.ejs +6 -50
  24. package/build/templates/packages/expo-router/tabs/app/(tabs)/index.tsx.ejs +18 -84
  25. package/build/templates/packages/expo-router/tabs/app/(tabs)/two.tsx.ejs +18 -83
  26. package/build/templates/packages/expo-router/tabs/app/_layout.tsx.ejs +3 -0
  27. package/build/templates/packages/expo-router/tabs/app/modal.tsx.ejs +17 -92
  28. package/build/templates/packages/i18next/components/InternalizationExample.tsx.ejs +23 -0
  29. package/build/templates/packages/i18next/core/i18n/fallbackChecker.ts.ejs +13 -0
  30. package/build/templates/packages/i18next/core/i18n/init.ts.ejs +24 -0
  31. package/build/templates/packages/i18next/core/i18n/languageDetector.ts.ejs +13 -0
  32. package/build/templates/packages/i18next/translation/en.json.ejs +8 -0
  33. package/build/templates/packages/i18next/translation/fr.json.ejs +8 -0
  34. package/build/templates/packages/i18next/translation/index.ts.ejs +20 -0
  35. package/build/templates/packages/nativewind/components/BackButton.tsx.ejs +18 -0
  36. package/build/templates/packages/nativewind/components/Button.tsx.ejs +14 -0
  37. package/build/templates/packages/nativewind/components/EditScreenInfo.tsx.ejs +40 -0
  38. package/build/templates/packages/nativewind/components/ScreenContent.tsx.ejs +25 -0
  39. package/build/templates/packages/react-navigation/App.tsx.ejs +4 -1
  40. package/build/templates/packages/react-navigation/navigation/drawer-navigator.tsx.ejs +14 -26
  41. package/build/templates/packages/react-navigation/navigation/index.tsx.ejs +2 -101
  42. package/build/templates/packages/react-navigation/navigation/tab-navigator.tsx.ejs +8 -62
  43. package/build/templates/packages/react-navigation/screens/details.tsx.ejs +22 -108
  44. package/build/templates/packages/react-navigation/screens/home.tsx.ejs +3 -82
  45. package/build/templates/packages/react-navigation/screens/modal.tsx.ejs +16 -104
  46. package/build/templates/packages/react-navigation/screens/one.tsx.ejs +2 -97
  47. package/build/templates/packages/react-navigation/screens/overview.tsx.ejs +37 -182
  48. package/build/templates/packages/react-navigation/screens/two.tsx.ejs +3 -98
  49. package/build/templates/packages/restyle/components/BackButton.tsx.ejs +15 -0
  50. package/build/templates/packages/restyle/components/Button.tsx.ejs +32 -0
  51. package/build/templates/packages/restyle/components/EditScreenInfo.tsx.ejs +29 -0
  52. package/build/templates/packages/restyle/components/ScreenContent.tsx.ejs +20 -0
  53. package/build/templates/packages/tamagui/components/BackButton.tsx.ejs +19 -0
  54. package/build/templates/packages/tamagui/components/Button.tsx.ejs +9 -0
  55. package/build/templates/packages/tamagui/components/EditScreenInfo.tsx.ejs +29 -0
  56. package/build/templates/packages/tamagui/components/ScreenContent.tsx.ejs +22 -0
  57. package/build/templates/packages/unistyles/components/BackButton.tsx.ejs +26 -0
  58. package/build/templates/packages/unistyles/components/Button.tsx.ejs +12 -0
  59. package/build/templates/packages/unistyles/components/EditScreenInfo.tsx.ejs +61 -0
  60. package/build/templates/packages/unistyles/components/ScreenContent.tsx.ejs +24 -0
  61. package/build/templates/packages/unistyles/theme.ts.ejs +30 -46
  62. package/build/types/types.d.ts +3 -2
  63. package/build/types/utilities/configureProjectFiles.d.ts +1 -1
  64. package/build/types/utilities/generateProjectFiles.d.ts +1 -1
  65. package/build/types.js +3 -2
  66. package/build/utilities/configureProjectFiles.js +86 -19
  67. package/build/utilities/generateProjectFiles.js +8 -4
  68. package/build/utilities/runCLI.js +24 -8
  69. package/build/utilities/showHelp.js +4 -1
  70. package/package.json +66 -66
  71. package/build/templates/base/.prettierrc +0 -7
  72. package/build/templates/packages/expo-router/drawer/components/edit-screen-info.tsx.ejs +0 -153
  73. package/build/templates/packages/expo-router/index.js +0 -4
  74. package/build/templates/packages/expo-router/index.ts +0 -1
  75. package/build/templates/packages/expo-router/tabs/components/edit-screen-info.tsx.ejs +0 -153
  76. package/build/templates/packages/react-navigation/components/edit-screen-info.tsx.ejs +0 -180
  77. package/build/types/templates/packages/expo-router/index.d.ts +0 -1
  78. /package/build/templates/packages/expo-router/drawer/app/{[...unmatched].tsx.ejs → +not-found.tsx.ejs} +0 -0
  79. /package/build/templates/packages/expo-router/stack/app/{[...unmatched].tsx.ejs → +not-found.tsx.ejs} +0 -0
  80. /package/build/templates/packages/expo-router/tabs/app/{[...unmatched].tsx.ejs → +not-found.tsx.ejs} +0 -0
@@ -1,188 +1,43 @@
1
- import { useNavigation } from "@react-navigation/native";
2
- import { StackNavigationProp } from "@react-navigation/stack";
3
- <% if (props.stylingPackage?.name === "nativewind") { %>
4
- import { Text, TouchableOpacity, View } from "react-native";
5
- <% } else if (props.stylingPackage?.name === "tamagui") { %>
6
- import { YStack } from "tamagui";
7
- import { Container, Main, Title, Subtitle, Button, ButtonText } from '../../tamagui.config';
8
- <% } else if (props.stylingPackage?.name === "restyle") { %>
9
- import { TouchableOpacity } from 'react-native';
10
- import { Box, Text, makeStyles } from 'theme';
11
- <% } else if (props.stylingPackage?.name === "unistyles") { %>
12
- import { createStyleSheet, useStyles } from 'react-native-unistyles'
13
- import { Text, TouchableOpacity, View } from 'react-native';
14
- <% } else { %>
15
- import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
1
+ import { useNavigation } from '@react-navigation/native';
2
+ import { StackNavigationProp } from '@react-navigation/stack';
3
+ import { ScreenContent } from 'components/ScreenContent';
4
+ import { StyleSheet, View } from 'react-native';
5
+
6
+ <% if (props.internalizationPackage?.name === "i18next") { %>
7
+ import { InternalizationExample } from 'components/InternalizationExample';
16
8
  <% } %>
17
- import { RootStackParamList } from "../navigation";
18
9
 
19
- type OverviewScreenNavigationProps = StackNavigationProp<RootStackParamList, "Overview">;
10
+ import { Button } from '../components/Button';
11
+ import { RootStackParamList } from '../navigation';
12
+
13
+ type OverviewScreenNavigationProps = StackNavigationProp<RootStackParamList, 'Overview'>;
20
14
 
21
15
  export default function Overview() {
22
- const navigation = useNavigation<OverviewScreenNavigationProps>();
23
- <% if (props.stylingPackage?.name === "nativewind") { %>
24
- return (
25
- <View className={styles.container}>
26
- <View className={styles.main}>
27
- <View>
28
- <Text className={styles.title}>Hello World</Text>
29
- <Text className={styles.subtitle}>This is the first page of your app.</Text>
30
- </View>
31
- <TouchableOpacity className={styles.button} onPress={() => navigation.navigate("Details", { name: "Dan" })}>
32
- <Text className={styles.buttonText}>Show Details</Text>
33
- </TouchableOpacity>
34
- </View>
35
- </View>
36
- );
37
- <% } else if (props.stylingPackage?.name === "tamagui") { %>
38
- return (
39
- <Container>
40
- <Main>
41
- <YStack>
42
- <Title>Hello World</Title>
43
- <Subtitle>This is the first page of your app.</Subtitle>
44
- </YStack>
45
- <Button onPress={() => navigation.navigate("Details", { name: "Dan" })}>
46
- <ButtonText>Show Details</ButtonText>
47
- </Button>
48
- </Main>
49
- </Container>
50
- );
51
- <% } else if (props.stylingPackage?.name === "restyle") { %>
52
- const styles = useStyles();
53
- return (
54
- <Box flex={1} padding="ml_24">
55
- <Box flex={1} maxWidth={960} justifyContent="space-between">
56
- <Box>
57
- <Text variant="extra_large">Hello World</Text>
58
- <Text variant="large" color="darkGray">
59
- This is the first page of your app.
60
- </Text>
61
- </Box>
62
- <TouchableOpacity
63
- style={styles.button}
64
- onPress={() => navigation.navigate('Details', { name: 'Dan' })}>
65
- <Text variant="body" textAlign="center" color="white" fontWeight="600">
66
- Show Details
67
- </Text>
68
- </TouchableOpacity>
69
- </Box>
70
- </Box>
71
- );
72
- <% } else if (props.stylingPackage?.name === "unistyles") { %>
73
- const { styles, theme } = useStyles(stylesheet)
74
- return (
75
- <View style={styles.container}>
76
- <View style={styles.main}>
77
- <View>
78
- <Text style={theme.components.title}>Hello World</Text>
79
- <Text style={theme.components.subtitle}>This is the first page of your app.</Text>
80
- </View>
81
- <TouchableOpacity style={theme.components.button} onPress={() => navigation.navigate('Details', { name: 'Dan' })}>
82
- <Text style={theme.components.buttonText}>Show Details</Text>
83
- </TouchableOpacity>
84
- </View>
85
- </View>
86
- );
87
- <% } else { %>
88
- return (
89
- <View style={styles.container}>
90
- <View style={styles.main}>
91
- <View>
92
- <Text style={styles.title}>Hello World</Text>
93
- <Text style={styles.subtitle}>This is the first page of your app.</Text>
94
- </View>
95
- <TouchableOpacity style={styles.button} onPress={() => navigation.navigate("Details", { name: "Dan" })}>
96
- <Text style={styles.buttonText}>Show Details</Text>
97
- </TouchableOpacity>
98
- </View>
99
- </View>
100
- );
101
- <% } %>
16
+ const navigation = useNavigation<OverviewScreenNavigationProps>();
17
+
18
+ return (
19
+ <View style={styles.container}>
20
+ <ScreenContent path="screens/overview.tsx" title="Overview">
21
+ <% if (props.internalizationPackage?.name === "i18next") { %>
22
+ <InternalizationExample />
23
+ <% } %>
24
+ </ScreenContent>
25
+ <Button
26
+ onPress={() =>
27
+ navigation.navigate('Details', {
28
+ name: 'Dan',
29
+ })
30
+ }
31
+ title="Show Details"
32
+ />
33
+ </View>
34
+ );
102
35
  }
103
36
 
104
- <% if (props.stylingPackage?.name === "nativewind") { %>
105
- const styles = {
106
- button: "items-center bg-indigo-500 rounded-[28px] shadow-md p-4",
107
- buttonText: "text-white text-lg font-semibold text-center",
108
- container: "flex-1 p-6",
109
- main: "flex-1 max-w-[960] justify-between",
110
- title: "text-[64px] font-bold",
111
- subtitle: "text-4xl text-gray-700",
112
- };
113
- <% } else if (props.stylingPackage?.name === "restyle") { %>
114
- const useStyles = makeStyles((theme) => ({
115
- button: {
116
- alignItems: 'center',
117
- backgroundColor: theme.colors.purple,
118
- borderRadius: theme.borderRadii.xl_24,
119
- elevation: 5,
120
- flexDirection: 'row',
121
- justifyContent: 'center',
122
- padding: theme.spacing.m_16,
123
- shadowColor: theme.colors.black,
124
- shadowOffset: {
125
- height: 2,
126
- width: 0,
127
- },
128
- shadowOpacity: 0.25,
129
- shadowRadius: 3.84,
130
- },
131
- }));
132
- <% } else if (props.stylingPackage?.name === "unistyles") { %>
133
- const stylesheet = createStyleSheet({
134
- container: {
135
- flex: 1,
136
- padding: 24,
137
- },
138
- main: {
139
- flex: 1,
140
- maxWidth: 960,
141
- marginHorizontal: 'auto',
142
- justifyContent: 'space-between',
143
- },
144
- });
145
- <% } else if (props.stylingPackage?.name === "stylesheet") { %>
146
- const styles = StyleSheet.create({
147
- button: {
148
- alignItems: "center",
149
- backgroundColor: "#6366F1",
150
- borderRadius: 24,
151
- elevation: 5,
152
- flexDirection: "row",
153
- justifyContent: "center",
154
- padding: 16,
155
- shadowColor: "#000",
156
- shadowOffset: {
157
- height: 2,
158
- width: 0
159
- },
160
- shadowOpacity: 0.25,
161
- shadowRadius: 3.84
162
- },
163
- buttonText: {
164
- color: "#FFFFFF",
165
- fontSize: 16,
166
- fontWeight: "600",
167
- textAlign: "center",
168
- },
169
- container: {
170
- flex: 1,
171
- padding: 24,
172
- },
173
- main: {
174
- flex: 1,
175
- maxWidth: 960,
176
- marginHorizontal: "auto",
177
- justifyContent: "space-between",
178
- },
179
- title: {
180
- fontSize: 64,
181
- fontWeight: "bold",
182
- },
183
- subtitle: {
184
- color: "#38434D",
185
- fontSize: 36,
186
- }
187
- });
188
- <% } %>
37
+
38
+ export const styles = StyleSheet.create({
39
+ container: {
40
+ flex: 1,
41
+ padding: 24,
42
+ },
43
+ });
@@ -1,100 +1,5 @@
1
- <% if (props.stylingPackage?.name === "nativewind") { %>
2
- import { Text, View } from "react-native";
3
- <% } else if (props.stylingPackage?.name === "tamagui") { %>
4
- import { YStack, H2, Separator, Theme } from "tamagui";
5
- <% } else if (props.stylingPackage?.name === "restyle") { %>
6
- import { Box, Text, makeStyles } from 'theme';
7
- <% } else if (props.stylingPackage?.name === "unistyles") { %>
8
- import { useStyles } from 'react-native-unistyles'
9
- import { Text, View } from 'react-native';
10
- <% } else { %>
11
- import { StyleSheet, Text, View } from "react-native";
12
- <% } %>
13
-
14
- import EditScreenInfo from "../components/edit-screen-info";
1
+ import { ScreenContent } from 'components/ScreenContent';
15
2
 
16
3
  export default function TabTwoScreen() {
17
- <% if (props.stylingPackage?.name === "nativewind") { %>
18
- return (
19
- <View className={styles.container}>
20
- <Text className={styles.title}>Tab Two</Text>
21
- <View className={styles.separator} />
22
- <EditScreenInfo path="src/screens/two.tsx" />
23
- </View>
24
- );
25
- <% } else if (props.stylingPackage?.name === "tamagui") { %>
26
- return (
27
- <Theme name="light">
28
- <YStack flex={1} alignItems="center" justifyContent="center">
29
- <H2>Tab Two</H2>
30
- <Separator />
31
- <EditScreenInfo path="src/screens/two.tsx" />
32
- </YStack>
33
- </Theme>
34
- );
35
- <% } else if (props.stylingPackage?.name === "unistyles") { %>
36
- const { theme } = useStyles()
37
- return (
38
- <View style={theme.components.container}>
39
- <Text style={theme.components.title}>Tab Two</Text>
40
- <View style={theme.components.separator} />
41
- <EditScreenInfo path='src/screens/two.tsx' />
42
- </View>
43
- );
44
- <% } else if (props.stylingPackage?.name === "restyle") { %>
45
- const styles = useStyles();
46
-
47
- return (
48
- <Box flex={1} alignItems="center" justifyContent="center">
49
- <Text variant="title">Tab Two</Text>
50
- <Box style={styles.separator} />
51
- <EditScreenInfo path="src/screens/two.tsx" />
52
- </Box>
53
- );
54
- <% } else { %>
55
- return (
56
- <View style={styles.container}>
57
- <Text style={styles.title}>Tab Two</Text>
58
- <View style={styles.separator} />
59
- <EditScreenInfo path="src/screens/two.tsx" />
60
- </View>
61
- );
62
- <% } %>
63
- }
64
-
65
- <% if (props.stylingPackage?.name === "nativewind") { %>
66
- const styles = {
67
- container: "items-center flex-1 justify-center",
68
- separator: "h-[1px] my-7 w-4/5 bg-gray-200",
69
- title: "text-xl font-bold"
70
- };
71
- <% } else if (props.stylingPackage?.name === "restyle") { %>
72
- const useStyles = makeStyles((theme) => ({
73
- separator: {
74
- backgroundColor: theme.colors.gray,
75
- height: 1,
76
- marginVertical: theme.spacing.l_32,
77
- opacity: 0.25,
78
- width: '80%',
79
- },
80
- }));
81
- <% } else if (props.stylingPackage?.name === "stylesheet") { %>
82
- const styles = StyleSheet.create({
83
- container: {
84
- alignItems: "center",
85
- flex: 1,
86
- justifyContent: "center",
87
- },
88
- separator: {
89
- backgroundColor: "gray",
90
- height: 1,
91
- marginVertical: 30,
92
- opacity: 0.25,
93
- width: "80%",
94
- },
95
- title: {
96
- fontSize: 20,
97
- fontWeight: "bold",
98
- }
99
- });
100
- <% } %>
4
+ return <ScreenContent path="screens/two.tsx" title="Tab Two" />;
5
+ }
@@ -0,0 +1,15 @@
1
+ import { Feather } from '@expo/vector-icons';
2
+ import { Box, Text, useTheme } from 'theme';
3
+
4
+ export const BackButton = ({ onPress }: { onPress: () => void }) => {
5
+ const { colors } = useTheme();
6
+
7
+ return (
8
+ <Box flexDirection="row" paddingLeft="m_16">
9
+ <Feather name="chevron-left" size={16} color={colors.blue} />
10
+ <Text marginLeft="xs_4" color="blue" onPress={onPress}>
11
+ Back
12
+ </Text>
13
+ </Box>
14
+ );
15
+ };
@@ -0,0 +1,32 @@
1
+ import { TouchableOpacity } from 'react-native';
2
+ import { Text, makeStyles } from 'theme';
3
+
4
+ export const Button = ({ onPress, title }: { onPress: () => void; title: string }) => {
5
+ const styles = useStyles();
6
+
7
+ return (
8
+ <TouchableOpacity style={styles.button} onPress={onPress}>
9
+ <Text variant="body" textAlign="center" color="white" fontWeight="600">
10
+ {title}
11
+ </Text>
12
+ </TouchableOpacity>
13
+ );
14
+ };
15
+ export const useStyles = makeStyles((theme) => ({
16
+ button: {
17
+ alignItems: 'center',
18
+ backgroundColor: theme.colors.purple,
19
+ borderRadius: theme.borderRadii.xl_24,
20
+ elevation: 5,
21
+ flexDirection: 'row',
22
+ justifyContent: 'center',
23
+ padding: theme.spacing.m_16,
24
+ shadowColor: theme.colors.black,
25
+ shadowOffset: {
26
+ height: 2,
27
+ width: 0,
28
+ },
29
+ shadowOpacity: 0.25,
30
+ shadowRadius: 3.84,
31
+ },
32
+ }));
@@ -0,0 +1,29 @@
1
+ import { Box, Text } from 'theme';
2
+
3
+ <% if (props.internalizationPackage?.name === "i18next") { %>
4
+ import { useTranslation } from 'react-i18next';
5
+ <% } %>
6
+
7
+ export const EditScreenInfo = ({ path }: { path: string }) => {
8
+ <% if (props.internalizationPackage?.name === "i18next") { %>
9
+ const { t } = useTranslation();
10
+ const title = t('getStarted');
11
+ const description = t('changeCode')
12
+ <% } else { %>
13
+ const title = "Open up the code for this screen:"
14
+ const description = "Change any of the text, save the file, and your app will automatically update."
15
+ <% } %>
16
+ return (
17
+ <Box alignItems="center" marginHorizontal="xl_64">
18
+ <Text variant="body" lineHeight={24} textAlign="center">
19
+ {title}
20
+ </Text>
21
+ <Box borderRadius="s_3" paddingHorizontal="xs_4" marginVertical="s_8">
22
+ <Text>{path}</Text>
23
+ </Box>
24
+ <Text variant="body" lineHeight={24} textAlign="center">
25
+ {description}
26
+ </Text>
27
+ </Box>
28
+ );
29
+ };
@@ -0,0 +1,20 @@
1
+ import { Box, Text } from 'theme';
2
+
3
+ import { EditScreenInfo } from './EditScreenInfo';
4
+
5
+ type ScreenContentProps = {
6
+ title: string;
7
+ path: string;
8
+ children?: React.ReactNode;
9
+ };
10
+
11
+ export const ScreenContent = ({ title, path, children }: ScreenContentProps ) => {
12
+ return (
13
+ <Box flex={1} alignItems="center" justifyContent="center">
14
+ <Text variant="title">{title}</Text>
15
+ <Box height={1} marginVertical="l_32" width="80%" backgroundColor="gray" />
16
+ <EditScreenInfo path={path} />
17
+ {children}
18
+ </Box>
19
+ );
20
+ };
@@ -0,0 +1,19 @@
1
+ import { Feather } from '@expo/vector-icons';
2
+ import { Button, Text } from 'tamagui';
3
+
4
+ export const BackButton = ({ onPress }: { onPress: () => void }) => {
5
+ return (
6
+ <Button
7
+ unstyled
8
+ flexDirection="row"
9
+ backgroundColor="transparent"
10
+ pressStyle={{
11
+ opacity: 0.5,
12
+ }}
13
+ paddingLeft={20}
14
+ onPress={onPress}
15
+ icon={<Feather name="chevron-left" size={16} color="#007AFF" />}>
16
+ <Text color="#007AFF">Back</Text>
17
+ </Button>
18
+ );
19
+ };
@@ -0,0 +1,9 @@
1
+ import { Button as TButton, ButtonText } from '../tamagui.config';
2
+
3
+ export const Button = ({ onPress, title }: { onPress: () => void; title: string }) => {
4
+ return (
5
+ <TButton onPress={onPress}>
6
+ <ButtonText>{title}</ButtonText>
7
+ </TButton>
8
+ );
9
+ };
@@ -0,0 +1,29 @@
1
+ import { YStack, H4, Paragraph } from 'tamagui';
2
+
3
+ <% if (props.internalizationPackage?.name === "i18next") { %>
4
+ import { useTranslation } from 'react-i18next';
5
+ <% } %>
6
+
7
+ export const EditScreenInfo = ({ path }: { path: string }) => {
8
+ <% if (props.internalizationPackage?.name === "i18next") { %>
9
+ const { t } = useTranslation();
10
+ const title = t('getStarted');
11
+ const description = t('changeCode')
12
+ <% } else { %>
13
+ const title = "Open up the code for this screen:"
14
+ const description = "Change any of the text, save the file, and your app will automatically update."
15
+ <% } %>
16
+ return (
17
+ <YStack>
18
+ <YStack alignItems="center" marginHorizontal="$6">
19
+ <H4>{title}</H4>
20
+ <YStack borderRadius="$3" marginVertical="$1">
21
+ <Paragraph>{path}</Paragraph>
22
+ </YStack>
23
+ <Paragraph>
24
+ {description}
25
+ </Paragraph>
26
+ </YStack>
27
+ </YStack>
28
+ );
29
+ };
@@ -0,0 +1,22 @@
1
+ import { YStack, H2, Separator, Theme } from 'tamagui';
2
+
3
+ import { EditScreenInfo } from './EditScreenInfo';
4
+
5
+ type ScreenContentProps = {
6
+ title: string;
7
+ path: string;
8
+ children?: React.ReactNode;
9
+ };
10
+
11
+ export const ScreenContent = ({ title, path, children}: ScreenContentProps) => {
12
+ return (
13
+ <Theme name="light">
14
+ <YStack flex={1} alignItems="center" justifyContent="center">
15
+ <H2>{title}</H2>
16
+ <Separator />
17
+ <EditScreenInfo path={path} />
18
+ {children}
19
+ </YStack>
20
+ </Theme>
21
+ );
22
+ };
@@ -0,0 +1,26 @@
1
+ import { Feather } from '@expo/vector-icons';
2
+ import { Text, View } from 'react-native';
3
+ import { createStyleSheet, useStyles } from 'react-native-unistyles';
4
+
5
+ export const BackButton = ({ onPress }: { onPress: () => void; }) => {
6
+ const { styles, theme } = useStyles(stylesheet);
7
+
8
+ return (
9
+ <View style={styles.backButton}>
10
+ <Feather name="chevron-left" size={16} color={theme.colors.azureRadiance} />
11
+ <Text style={styles.backButtonText} onPress={onPress}>
12
+ Back
13
+ </Text>
14
+ </View>
15
+ );
16
+ };
17
+ const stylesheet = createStyleSheet((theme) => ({
18
+ backButton: {
19
+ flexDirection: 'row',
20
+ paddingLeft: 20,
21
+ },
22
+ backButtonText: {
23
+ color: theme.colors.azureRadiance,
24
+ marginLeft: 4,
25
+ },
26
+ }));
@@ -0,0 +1,12 @@
1
+ import { Text, TouchableOpacity } from 'react-native';
2
+ import { useStyles } from 'react-native-unistyles';
3
+
4
+ export const Button = ({ onPress, title }: { onPress: () => void; title: string }) => {
5
+ const { theme } = useStyles();
6
+
7
+ return (
8
+ <TouchableOpacity style={theme.components.button} onPress={onPress}>
9
+ <Text style={theme.components.buttonText}>{title}</Text>
10
+ </TouchableOpacity>
11
+ );
12
+ };
@@ -0,0 +1,61 @@
1
+ import { Text, View } from 'react-native';
2
+ import { createStyleSheet, useStyles } from 'react-native-unistyles';
3
+
4
+ <% if (props.internalizationPackage?.name === "i18next") { %>
5
+ import { useTranslation } from 'react-i18next';
6
+ <% } %>
7
+
8
+ export const EditScreenInfo = ({ path }: { path: string }) => {
9
+ const { styles } = useStyles(stylesheet);
10
+ <% if (props.internalizationPackage?.name === "i18next") { %>
11
+ const { t } = useTranslation();
12
+ const title = t('getStarted');
13
+ const description = t('changeCode')
14
+ <% } else { %>
15
+ const title = "Open up the code for this screen:"
16
+ const description = "Change any of the text, save the file, and your app will automatically update."
17
+ <% } %>
18
+ return (
19
+ <View>
20
+ <View style={styles.getStartedContainer}>
21
+ <Text style={styles.getStartedText}>{title}</Text>
22
+ <View style={[styles.codeHighlightContainer, styles.homeScreenFilename]}>
23
+ <Text>{path}</Text>
24
+ </View>
25
+ <Text style={styles.getStartedText}>
26
+ {description}
27
+ </Text>
28
+ </View>
29
+ </View>
30
+ );
31
+ }
32
+
33
+ const stylesheet = createStyleSheet({
34
+ codeHighlightContainer: {
35
+ borderRadius: 3,
36
+ paddingHorizontal: 4,
37
+ },
38
+ getStartedContainer: {
39
+ alignItems: 'center',
40
+ marginHorizontal: 50,
41
+ },
42
+ getStartedText: {
43
+ fontSize: 17,
44
+ lineHeight: 24,
45
+ textAlign: 'center',
46
+ },
47
+ helpContainer: {
48
+ alignItems: 'center',
49
+ marginHorizontal: 20,
50
+ marginTop: 15,
51
+ },
52
+ helpLink: {
53
+ paddingVertical: 15,
54
+ },
55
+ helpLinkText: {
56
+ textAlign: 'center',
57
+ },
58
+ homeScreenFilename: {
59
+ marginVertical: 7,
60
+ },
61
+ });
@@ -0,0 +1,24 @@
1
+ import { Text, View } from 'react-native';
2
+ import { useStyles } from 'react-native-unistyles';
3
+
4
+ import { EditScreenInfo } from './EditScreenInfo';
5
+
6
+ type ScreenContentProps = {
7
+ title: string;
8
+ path: string;
9
+ children?: React.ReactNode;
10
+ };
11
+
12
+
13
+ export const ScreenContent = ({ title, path, children } : ScreenContentProps) => {
14
+ const { theme } = useStyles();
15
+
16
+ return (
17
+ <View style={theme.components.container}>
18
+ <Text style={theme.components.title}>{title}</Text>
19
+ <View style={theme.components.separator} />
20
+ <EditScreenInfo path={path} />
21
+ {children}
22
+ </View>
23
+ );
24
+ };