create-expo-stack 2.3.15 → 2.4.0-next.43d8ac0

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 (44) hide show
  1. package/README.md +8 -1
  2. package/build/commands/create-expo-stack.js +23 -2
  3. package/build/templates/base/App.tsx.ejs +34 -0
  4. package/build/templates/base/package.json.ejs +9 -0
  5. package/build/templates/packages/expo-router/drawer/app/(drawer)/index.tsx.ejs +33 -1
  6. package/build/templates/packages/expo-router/drawer/app/(drawer)/news.tsx.ejs +34 -1
  7. package/build/templates/packages/expo-router/drawer/app/[...unmatched].tsx.ejs +51 -0
  8. package/build/templates/packages/expo-router/drawer/app/_layout.tsx.ejs +10 -2
  9. package/build/templates/packages/expo-router/stack/app/[...unmatched].tsx.ejs +53 -0
  10. package/build/templates/packages/expo-router/stack/app/_layout.tsx.ejs +9 -3
  11. package/build/templates/packages/expo-router/stack/app/details.tsx.ejs +61 -0
  12. package/build/templates/packages/expo-router/stack/app/index.tsx.ejs +101 -2
  13. package/build/templates/packages/expo-router/tabs/app/(tabs)/_layout.tsx.ejs +23 -1
  14. package/build/templates/packages/expo-router/tabs/app/(tabs)/index.tsx.ejs +33 -0
  15. package/build/templates/packages/expo-router/tabs/app/(tabs)/two.tsx.ejs +33 -0
  16. package/build/templates/packages/expo-router/tabs/app/[...unmatched].tsx.ejs +53 -0
  17. package/build/templates/packages/expo-router/tabs/app/_layout.tsx.ejs +8 -0
  18. package/build/templates/packages/expo-router/tabs/app/modal.tsx.ejs +35 -0
  19. package/build/templates/packages/expo-router/tabs/components/edit-screen-info.tsx.ejs +52 -1
  20. package/build/templates/packages/react-navigation/App.tsx.ejs +11 -1
  21. package/build/templates/packages/react-navigation/components/edit-screen-info.tsx.ejs +82 -1
  22. package/build/templates/packages/react-navigation/navigation/index.tsx.ejs +38 -3
  23. package/build/templates/packages/react-navigation/navigation/tab-navigator.tsx.ejs +30 -3
  24. package/build/templates/packages/react-navigation/screens/details.tsx.ejs +46 -0
  25. package/build/templates/packages/react-navigation/screens/modal.tsx.ejs +57 -1
  26. package/build/templates/packages/react-navigation/screens/one.tsx.ejs +53 -0
  27. package/build/templates/packages/react-navigation/screens/overview.tsx.ejs +105 -1
  28. package/build/templates/packages/react-navigation/screens/two.tsx.ejs +53 -0
  29. package/build/templates/packages/restyle/theme/Box.tsx.ejs +6 -0
  30. package/build/templates/packages/restyle/theme/Text.tsx.ejs +6 -0
  31. package/build/templates/packages/restyle/theme/index.ts.ejs +6 -0
  32. package/build/templates/packages/restyle/theme/theme.ts.ejs +67 -0
  33. package/build/templates/packages/unistyles/breakpoints.ts.ejs +9 -0
  34. package/build/templates/packages/unistyles/theme.ts.ejs +26 -0
  35. package/build/templates/packages/unistyles/unistyles.ts.ejs +28 -0
  36. package/build/types/types.d.ts +1 -1
  37. package/build/types/utilities/printOutput.d.ts +2 -2
  38. package/build/types.js +4 -2
  39. package/build/utilities/configureProjectFiles.js +22 -1
  40. package/build/utilities/generateProjectFiles.js +7 -1
  41. package/build/utilities/printOutput.js +14 -2
  42. package/build/utilities/runCLI.js +10 -2
  43. package/build/utilities/showHelp.js +3 -1
  44. package/package.json +66 -66
@@ -6,6 +6,11 @@
6
6
  import { Text, View } from "react-native";
7
7
  <% } else if (props.stylingPackage?.name === "tamagui") { %>
8
8
  import { Button, Text } from "tamagui";
9
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
10
+ import { Box, Text, useTheme } from 'theme';
11
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
12
+ import { createStyleSheet, useStyles } from 'react-native-unistyles'
13
+ import { Text, View } from "react-native";
9
14
  <% } else { %>
10
15
  import { Text, View, StyleSheet } from "react-native";
11
16
  <% } %>
@@ -21,6 +26,14 @@
21
26
  const Stack = createStackNavigator<RootStackParamList>();
22
27
 
23
28
  export default function RootStack() {
29
+ <% if (props.stylingPackage?.name === "restyle") { %>
30
+ const { colors } = useTheme();
31
+ <% } %>
32
+
33
+ <% if (props.stylingPackage?.name === "unistyles") { %>
34
+ const { styles } = useStyles(stylesheet)
35
+ <% } %>
36
+
24
37
  return (
25
38
  <NavigationContainer>
26
39
  <Stack.Navigator initialRouteName="Overview">
@@ -53,6 +66,17 @@
53
66
  </Button>
54
67
  ),
55
68
  })}
69
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
70
+ options={({ navigation }) => ({
71
+ headerLeft: () => (
72
+ <Box flexDirection="row" paddingLeft="m_16">
73
+ <Feather name="chevron-left" size={16} color={colors.blue} />
74
+ <Text marginLeft="xs_4" color="blue" onPress={navigation.goBack}>
75
+ Back
76
+ </Text>
77
+ </Box>
78
+ ),
79
+ })}
56
80
  <% } else { %>
57
81
  options={({ navigation }) => ({
58
82
  headerLeft: () => (
@@ -74,6 +98,17 @@
74
98
  backButton: "flex-row",
75
99
  backButtonText: "text-blue-500 ml-1"
76
100
  };
101
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
102
+ const stylesheet = createStyleSheet({
103
+ backButton: {
104
+ flexDirection: "row",
105
+ paddingLeft: 20,
106
+ },
107
+ backButtonText: {
108
+ color: "#007AFF",
109
+ marginLeft: 4
110
+ }
111
+ });
77
112
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
78
113
  const styles = StyleSheet.create({
79
114
  backButton: {
@@ -112,13 +147,13 @@
112
147
  <Stack.Screen
113
148
  name="Modal"
114
149
  component={Modal}
115
- options={{ presentation: "modal", headerLeft: null }}
150
+ options={{ presentation: "modal", headerLeft: () => null }}
116
151
  />
117
152
  </Stack.Navigator>
118
153
  </NavigationContainer>
119
154
  );
120
155
  }
121
- <% } else if (props.navigationPackage?.options.type === 'drawer') { %>
156
+ <% } else if (props.navigationPackage?.options.type === 'drawer') { %>
122
157
  import { NavigationContainer } from "@react-navigation/native";
123
158
  import { createStackNavigator } from '@react-navigation/stack';
124
159
 
@@ -150,4 +185,4 @@
150
185
  </NavigationContainer>
151
186
  );
152
187
  }
153
- <% } %>
188
+ <% } %>
@@ -1,7 +1,14 @@
1
1
  import FontAwesome from "@expo/vector-icons/FontAwesome";
2
- import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
2
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
3
+ import { StackScreenProps } from '@react-navigation/stack';
4
+ <% if (props.stylingPackage?.name === "unistyles") {%>
5
+ import { createStyleSheet, useStyles } from 'react-native-unistyles'
6
+ import { Pressable } from "react-native";
7
+ <% } else { %>
3
8
  import { Pressable, StyleSheet } from "react-native";
9
+ <% } %>
4
10
 
11
+ import { RootStackParamList } from '.';
5
12
  import One from "../screens/one";
6
13
  import Two from "../screens/two";
7
14
 
@@ -11,10 +18,19 @@ function TabBarIcon(props: {
11
18
  name: React.ComponentProps<typeof FontAwesome>["name"];
12
19
  color: string;
13
20
  }) {
21
+ <% if (props.stylingPackage?.name === "unistyles") {%>
22
+ const {styles} = useStyles(stylesheet)
23
+ <% } %>
14
24
  return <FontAwesome size={28} style={styles.tabBarIcon} {...props} />;
15
25
  }
16
26
 
17
- export default function TabLayout({ navigation }) {
27
+ type Props = StackScreenProps<RootStackParamList, 'TabNavigator'>;
28
+
29
+ export default function TabLayout({ navigation }: Props) {
30
+ <% if (props.stylingPackage?.name === "unistyles") {%>
31
+ const {styles} = useStyles(stylesheet)
32
+ <% } %>
33
+
18
34
  return (
19
35
  <Tab.Navigator
20
36
  screenOptions={{
@@ -52,6 +68,16 @@ export default function TabLayout({ navigation }) {
52
68
  );
53
69
  }
54
70
 
71
+ <% if (props.stylingPackage?.name === "unistyles") {%>
72
+ const stylesheet = createStyleSheet({
73
+ headerRight: {
74
+ marginRight: 15
75
+ },
76
+ tabBarIcon: {
77
+ marginBottom: -3
78
+ }
79
+ });
80
+ <% } else { %>
55
81
  const styles = StyleSheet.create({
56
82
  headerRight: {
57
83
  marginRight: 15
@@ -59,4 +85,5 @@ const styles = StyleSheet.create({
59
85
  tabBarIcon: {
60
86
  marginBottom: -3
61
87
  }
62
- });
88
+ });
89
+ <% } %>
@@ -4,6 +4,11 @@ import { RouteProp, useRoute } from "@react-navigation/native";
4
4
  <% } else if (props.stylingPackage?.name === "tamagui") { %>
5
5
  import { YStack } from "tamagui";
6
6
  import { Container, Main, Subtitle, Title } from "../../tamagui.config";
7
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
8
+ import { Box, Text } from 'theme';
9
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
10
+ import { createStyleSheet, useStyles } from 'react-native-unistyles'
11
+ import { View, Text } from "react-native";
7
12
  <% } else { %>
8
13
  import { View, StyleSheet, Text } from "react-native";
9
14
  <% } %>
@@ -33,6 +38,27 @@ export default function Details() {
33
38
  </Main>
34
39
  </Container>
35
40
  );
41
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
42
+ return (
43
+ <Box flex={1} padding="ml_24">
44
+ <Box flex={1} maxWidth={960}>
45
+ <Text variant="extra_large">Details</Text>
46
+ <Text variant="large" color="darkGray">
47
+ Showing details for user {router.params.name}.
48
+ </Text>
49
+ </Box>
50
+ </Box>
51
+ );
52
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
53
+ const {styles} = useStyles(stylesheet)
54
+ return (
55
+ <View style={styles.container}>
56
+ <View style={styles.main}>
57
+ <Text style={styles.title}>Details</Text>
58
+ <Text style={styles.subtitle}>Showing details for user {router.params.name}.</Text>
59
+ </View>
60
+ </View>
61
+ );
36
62
  <% } else { %>
37
63
  return (
38
64
  <View style={styles.container}>
@@ -52,6 +78,26 @@ export default function Details() {
52
78
  title: "text-[64px] font-bold",
53
79
  subtitle: "text-4xl text-gray-700",
54
80
  };
81
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
82
+ const stylesheet = createStyleSheet({
83
+ container: {
84
+ flex: 1,
85
+ padding: 24,
86
+ },
87
+ main: {
88
+ flex: 1,
89
+ maxWidth: 960,
90
+ marginHorizontal: "auto",
91
+ },
92
+ title: {
93
+ fontSize: 64,
94
+ fontWeight: "bold",
95
+ },
96
+ subtitle: {
97
+ fontSize: 36,
98
+ color: "#38434D",
99
+ },
100
+ });
55
101
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
56
102
  const styles = StyleSheet.create({
57
103
  container: {
@@ -3,6 +3,12 @@
3
3
  <% } else if (props.stylingPackage?.name === "tamagui") { %>
4
4
  import { YStack, Paragraph, Separator, Theme } from "tamagui";
5
5
  import { Platform } from 'react-native'
6
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
7
+ import { Platform } from 'react-native';
8
+ import { Box, Text, makeStyles } from 'theme';
9
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
10
+ import { createStyleSheet, useStyles } from 'react-native-unistyles'
11
+ import { Platform, Text, View } from "react-native";
6
12
  <% } else { %>
7
13
  import { Platform, StyleSheet, Text, View } from "react-native";
8
14
  <% } %>
@@ -20,7 +26,7 @@ export default function Modal() {
20
26
  <EditScreenInfo path="src/screens/modal.tsx" />
21
27
  </View>
22
28
  )
23
- <% } else if (props.stylingPackage?.name === "tamagui") { %>
29
+ <% } else if (props.stylingPackage?.name === "tamagui") { %>
24
30
  return (
25
31
  <Theme name="light">
26
32
  <YStack flex={1} alignItems="center" justifyContent="center">
@@ -31,6 +37,27 @@ export default function Modal() {
31
37
  </YStack>
32
38
  </Theme>
33
39
  );
40
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
41
+ const styles = useStyles();
42
+
43
+ return (
44
+ <Box flex={1} alignItems="center" justifyContent="center">
45
+ <StatusBar style={Platform.OS === 'ios' ? 'light' : 'auto'} />
46
+ <Text variant="title">Modal</Text>
47
+ <Box style={styles.separator} />
48
+ <EditScreenInfo path="src/screens/modal.tsx" />
49
+ </Box>
50
+ );
51
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
52
+ const {styles} = useStyles(stylesheet)
53
+ return (
54
+ <View style={styles.container}>
55
+ <StatusBar style={Platform.OS === "ios" ? "light" : "auto"} />
56
+ <Text style={styles.title}>Modal</Text>
57
+ <View style={styles.separator} />
58
+ <EditScreenInfo path="src/screens/modal.tsx" />
59
+ </View>
60
+ );
34
61
  <% } else { %>
35
62
  return (
36
63
  <View style={styles.container}>
@@ -49,6 +76,35 @@ export default function Modal() {
49
76
  separator: "h-[1px] my-7 w-4/5 bg-gray-200",
50
77
  title: "text-xl font-bold"
51
78
  };
79
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
80
+ const useStyles = makeStyles((theme) => ({
81
+ separator: {
82
+ backgroundColor: theme.colors.gray,
83
+ height: 1,
84
+ marginVertical: theme.spacing.l_32,
85
+ opacity: 0.25,
86
+ width: '80%',
87
+ },
88
+ }));
89
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
90
+ const stylesheet = createStyleSheet({
91
+ container: {
92
+ alignItems: "center",
93
+ flex: 1,
94
+ justifyContent: "center"
95
+ },
96
+ separator: {
97
+ backgroundColor: "gray",
98
+ height: 1,
99
+ marginVertical: 30,
100
+ opacity: 0.25,
101
+ width: "80%",
102
+ },
103
+ title: {
104
+ fontSize: 20,
105
+ fontWeight: "bold"
106
+ }
107
+ });
52
108
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
53
109
  const styles = StyleSheet.create({
54
110
  container: {
@@ -2,6 +2,11 @@
2
2
  import { Text, View } from "react-native";
3
3
  <% } else if (props.stylingPackage?.name === "tamagui") { %>
4
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 { createStyleSheet, useStyles } from 'react-native-unistyles'
9
+ import { Text, View } from "react-native";
5
10
  <% } else { %>
6
11
  import { StyleSheet, Text, View } from "react-native";
7
12
  <% } %>
@@ -27,6 +32,25 @@ export default function TabOneScreen() {
27
32
  </YStack>
28
33
  </Theme>
29
34
  );
35
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
36
+ const styles = useStyles();
37
+
38
+ return (
39
+ <Box flex={1} alignItems="center" justifyContent="center">
40
+ <Text variant="title">Tab One</Text>
41
+ <Box style={styles.separator} />
42
+ <EditScreenInfo path="src/screens/one.tsx" />
43
+ </Box>
44
+ );
45
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
46
+ const { styles } = useStyles(stylesheet)
47
+ return (
48
+ <View style={styles.container}>
49
+ <Text style={styles.title}>Tab One</Text>
50
+ <View style={styles.separator} />
51
+ <EditScreenInfo path="src/screens/one.tsx" />
52
+ </View>
53
+ );
30
54
  <% } else { %>
31
55
  return (
32
56
  <View style={styles.container}>
@@ -44,6 +68,35 @@ export default function TabOneScreen() {
44
68
  separator: "h-[1px] my-7 w-4/5 bg-gray-200",
45
69
  title: "text-xl font-bold"
46
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 === "unistyles") { %>
82
+ const stylesheet = createStyleSheet({
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
+ });
47
100
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
48
101
  const styles = StyleSheet.create({
49
102
  container: {
@@ -5,6 +5,12 @@ import { StackNavigationProp } from "@react-navigation/stack";
5
5
  <% } else if (props.stylingPackage?.name === "tamagui") { %>
6
6
  import { YStack } from "tamagui";
7
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";
8
14
  <% } else { %>
9
15
  import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
10
16
  <% } %>
@@ -42,7 +48,43 @@ export default function Overview() {
42
48
  </Main>
43
49
  </Container>
44
50
  );
45
- <% } else { %>
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} = useStyles(stylesheet)
74
+ return (
75
+ <View style={styles.container}>
76
+ <View style={styles.main}>
77
+ <View>
78
+ <Text style={styles.title}>Hello World</Text>
79
+ <Text style={styles.subtitle}>This is the first page of your app.</Text>
80
+ </View>
81
+ <TouchableOpacity style={styles.button} onPress={() => navigation.navigate("Details", { name: "Dan" })}>
82
+ <Text style={styles.buttonText}>Show Details</Text>
83
+ </TouchableOpacity>
84
+ </View>
85
+ </View>
86
+ );
87
+ <% } else { %>
46
88
  return (
47
89
  <View style={styles.container}>
48
90
  <View style={styles.main}>
@@ -68,6 +110,68 @@ export default function Overview() {
68
110
  title: "text-[64px] font-bold",
69
111
  subtitle: "text-4xl text-gray-700",
70
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
+ button: {
135
+ alignItems: "center",
136
+ backgroundColor: "#6366F1",
137
+ borderRadius: 24,
138
+ elevation: 5,
139
+ flexDirection: "row",
140
+ justifyContent: "center",
141
+ padding: 16,
142
+ shadowColor: "#000",
143
+ shadowOffset: {
144
+ height: 2,
145
+ width: 0
146
+ },
147
+ shadowOpacity: 0.25,
148
+ shadowRadius: 3.84
149
+ },
150
+ buttonText: {
151
+ color: "#FFFFFF",
152
+ fontSize: 16,
153
+ fontWeight: "600",
154
+ textAlign: "center",
155
+ },
156
+ container: {
157
+ flex: 1,
158
+ padding: 24,
159
+ },
160
+ main: {
161
+ flex: 1,
162
+ maxWidth: 960,
163
+ marginHorizontal: "auto",
164
+ justifyContent: "space-between",
165
+ },
166
+ title: {
167
+ fontSize: 64,
168
+ fontWeight: "bold",
169
+ },
170
+ subtitle: {
171
+ color: "#38434D",
172
+ fontSize: 36,
173
+ }
174
+ });
71
175
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
72
176
  const styles = StyleSheet.create({
73
177
  button: {
@@ -2,6 +2,11 @@
2
2
  import { Text, View } from "react-native";
3
3
  <% } else if (props.stylingPackage?.name === "tamagui") { %>
4
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 { createStyleSheet, useStyles } from 'react-native-unistyles'
9
+ import { Text, View } from "react-native";
5
10
  <% } else { %>
6
11
  import { StyleSheet, Text, View } from "react-native";
7
12
  <% } %>
@@ -26,7 +31,26 @@ export default function TabTwoScreen() {
26
31
  <EditScreenInfo path="src/screens/two.tsx" />
27
32
  </YStack>
28
33
  </Theme>
34
+ );
35
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
36
+ const { styles } = useStyles(stylesheet)
37
+ return (
38
+ <View style={styles.container}>
39
+ <Text style={styles.title}>Tab Two</Text>
40
+ <View style={styles.separator} />
41
+ <EditScreenInfo path="src/screens/two.tsx" />
42
+ </View>
29
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
+ );
30
54
  <% } else { %>
31
55
  return (
32
56
  <View style={styles.container}>
@@ -44,6 +68,35 @@ export default function TabTwoScreen() {
44
68
  separator: "h-[1px] my-7 w-4/5 bg-gray-200",
45
69
  title: "text-xl font-bold"
46
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 === "unistyles") { %>
82
+ const stylesheet = createStyleSheet({
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
+ });
47
100
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
48
101
  const styles = StyleSheet.create({
49
102
  container: {
@@ -0,0 +1,6 @@
1
+ import { createBox } from '@shopify/restyle';
2
+ import { Theme } from './theme';
3
+
4
+ const Box = createBox<Theme>();
5
+
6
+ export default Box;
@@ -0,0 +1,6 @@
1
+ import { createText } from '@shopify/restyle';
2
+ import { Theme } from './theme';
3
+
4
+ const Text = createText<Theme>();
5
+
6
+ export default Text;
@@ -0,0 +1,6 @@
1
+ import Box from './Box';
2
+ import Text from './Text';
3
+ import theme, { useTheme, Theme, makeStyles } from './theme';
4
+
5
+ export { theme, Box, Text, useTheme, Theme, makeStyles };
6
+
@@ -0,0 +1,67 @@
1
+ import { createTheme, useTheme as useRestyleTheme } from '@shopify/restyle';
2
+ import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
+
4
+ type NamedStyles<T> = {
5
+ [P in keyof T]: ViewStyle | TextStyle | ImageStyle;
6
+ };
7
+
8
+ const palette = {
9
+ gray: '#808080',
10
+ blue: '#007AFF',
11
+ darkGray: '#38434D',
12
+ white: '#FFFFFF',
13
+ black: '#000000',
14
+ purple: '#6366F1',
15
+ };
16
+
17
+ const theme = createTheme({
18
+ colors: {
19
+ ...palette
20
+ },
21
+ spacing: {
22
+ xs_4: 4,
23
+ s_8: 8,
24
+ sm_12: 12,
25
+ m_16: 16,
26
+ ml_24: 24,
27
+ l_32: 32,
28
+ xl_64: 64,
29
+ },
30
+ borderRadii: {
31
+ s_3: 3,
32
+ m_6: 6,
33
+ l_12: 12,
34
+ xl_24: 24,
35
+ },
36
+ textVariants: {
37
+ body: {
38
+ fontSize: 16,
39
+ },
40
+ title: { fontSize: 20, fontWeight: 'bold' },
41
+ large: {
42
+ fontSize: 36,
43
+ },
44
+ extra_large: {
45
+ fontSize: 64,
46
+ fontWeight: 'bold',
47
+ },
48
+ defaults: {
49
+ // We can define a default text variant here.
50
+ }
51
+ }
52
+ });
53
+
54
+ export const useTheme = () => {
55
+ return useRestyleTheme<Theme>();
56
+ };
57
+
58
+ export const makeStyles = <T extends NamedStyles<T> | NamedStyles<unknown>>(
59
+ styles: (theme: Theme) => T,
60
+ ) => {
61
+ return () => {
62
+ return styles(theme);
63
+ };
64
+ };
65
+
66
+ export type Theme = typeof theme;
67
+ export default theme;
@@ -0,0 +1,9 @@
1
+ export const breakpoints = {
2
+ xs: 0,
3
+ sm: 576,
4
+ md: 768,
5
+ lg: 992,
6
+ xl: 1200,
7
+ superLarge: 2000,
8
+ tvLike: 4000
9
+ } as const;