create-expo-stack 2.20.0-next.ff2bed4 → 2.21.0-next.0cb36d0

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 (90) hide show
  1. package/README.md +18 -20
  2. package/build/cli.js +3 -2
  3. package/build/commands/create-expo-stack.js +9 -30
  4. package/build/constants.js +4 -4
  5. package/build/templates/base/App.tsx.ejs +12 -51
  6. package/build/templates/base/app.json.ejs +1 -0
  7. package/build/templates/base/babel.config.js.ejs +5 -15
  8. package/build/templates/base/components/Button.tsx.ejs +1 -0
  9. package/build/templates/base/components/Container.tsx.ejs +1 -0
  10. package/build/templates/base/package.json.ejs +38 -63
  11. package/build/templates/base/tsconfig.json.ejs +12 -7
  12. package/build/templates/packages/expo-router/drawer/app/+not-found.tsx.ejs +19 -60
  13. package/build/templates/packages/expo-router/drawer/app/_layout.tsx.ejs +2 -41
  14. package/build/templates/packages/expo-router/metro.config.js.ejs +3 -3
  15. package/build/templates/packages/expo-router/stack/app/+not-found.tsx.ejs +42 -68
  16. package/build/templates/packages/expo-router/stack/app/_layout.tsx.ejs +20 -51
  17. package/build/templates/packages/expo-router/stack/app/details.tsx.ejs +39 -8
  18. package/build/templates/packages/expo-router/stack/app/index.tsx.ejs +69 -21
  19. package/build/templates/packages/expo-router/tabs/app/+not-found.tsx.ejs +21 -60
  20. package/build/templates/packages/expo-router/tabs/app/_layout.tsx.ejs +8 -48
  21. package/build/templates/packages/firebase/metro.config.js.ejs +3 -3
  22. package/build/templates/packages/nativewind/components/Button.tsx.ejs +1 -1
  23. package/build/templates/packages/nativewind/components/ScreenContent.tsx.ejs +3 -2
  24. package/build/templates/packages/nativewind/global.css +4 -1
  25. package/build/templates/packages/nativewind/postcss.config.mjs +2 -2
  26. package/build/templates/packages/nativewind/prettier.config.js +10 -0
  27. package/build/templates/packages/nativewindui/components/Container.tsx.ejs +1 -0
  28. package/build/templates/packages/nativewindui/components/EditScreenInfo.tsx.ejs +1 -1
  29. package/build/templates/packages/nativewindui/components/ScreenContent.tsx.ejs +1 -1
  30. package/build/templates/packages/nativewindui/components/nativewindui/Icon/Icon.ios.tsx.ejs +52 -0
  31. package/build/templates/packages/nativewindui/components/nativewindui/Icon/Icon.tsx.ejs +58 -0
  32. package/build/templates/packages/nativewindui/components/nativewindui/Icon/index.ts.ejs +16 -0
  33. package/build/templates/packages/nativewindui/components/nativewindui/Icon/types.ts.ejs +18 -0
  34. package/build/templates/packages/nativewindui/components/{ThemeToggle.tsx.ejs → nativewindui/ThemeToggle.tsx.ejs} +8 -10
  35. package/build/templates/packages/nativewindui/drawer/app/(drawer)/index.tsx.ejs +17 -19
  36. package/build/templates/packages/nativewindui/drawer/app/+not-found.tsx.ejs +4 -44
  37. package/build/templates/packages/nativewindui/drawer/app/_layout.tsx.ejs +2 -2
  38. package/build/templates/packages/nativewindui/drawer/app/modal.tsx.ejs +4 -4
  39. package/build/templates/packages/nativewindui/lib/useColorScheme.tsx.ejs +3 -37
  40. package/build/templates/packages/nativewindui/stack/app/+not-found.tsx.ejs +1 -1
  41. package/build/templates/packages/nativewindui/stack/app/_layout.tsx.ejs +17 -34
  42. package/build/templates/packages/nativewindui/stack/app/index.tsx.ejs +230 -275
  43. package/build/templates/packages/nativewindui/stack/app/modal.tsx.ejs +7 -7
  44. package/build/templates/packages/nativewindui/tabs/app/(tabs)/index.tsx.ejs +6 -7
  45. package/build/templates/packages/nativewindui/tabs/app/+not-found.tsx.ejs +0 -40
  46. package/build/templates/packages/nativewindui/theme/colors.ts.ejs +52 -0
  47. package/build/templates/packages/nativewindui/theme/index.ts.ejs +2 -2
  48. package/build/templates/packages/nativewindui/theme/with-opacity.ts.ejs +155 -0
  49. package/build/templates/packages/react-navigation/App.tsx.ejs +2 -42
  50. package/build/types/constants.d.ts +1 -1
  51. package/build/types/types.d.ts +3 -3
  52. package/build/types/utilities/configAnalytics.d.ts +2 -2
  53. package/build/types.js +1 -3
  54. package/build/utilities/clearNavigationPackages.js +2 -2
  55. package/build/utilities/clearStylingPackages.js +2 -2
  56. package/build/utilities/configAnalytics.js +5 -4
  57. package/build/utilities/configureProjectFiles.js +32 -69
  58. package/build/utilities/copyBaseAssets.js +3 -2
  59. package/build/utilities/generateNWUI.js +8 -7
  60. package/build/utilities/generateProjectFiles.js +4 -9
  61. package/build/utilities/getPackageManager.js +6 -5
  62. package/build/utilities/printOutput.js +5 -16
  63. package/build/utilities/renderTitle.js +3 -2
  64. package/build/utilities/runCLI.js +19 -27
  65. package/build/utilities/runEasConfigure.js +3 -2
  66. package/build/utilities/runIgnite.js +3 -2
  67. package/build/utilities/showHelp.js +4 -5
  68. package/build/utilities/systemCommand.js +3 -3
  69. package/build/utilities/usePackage.js +3 -2
  70. package/build/utilities/validateProjectName.js +3 -2
  71. package/package.json +6 -4
  72. package/build/templates/packages/nativewind/components/Container.tsx.ejs +0 -9
  73. package/build/templates/packages/nativewindui/components/BackButton.tsx.ejs +0 -23
  74. package/build/templates/packages/nativewindui/components/Button.tsx.ejs +0 -41
  75. package/build/templates/packages/nativewindui/lib/useHeaderSearchBar.tsx.ejs +0 -31
  76. package/build/templates/packages/restyle/components/BackButton.tsx.ejs +0 -15
  77. package/build/templates/packages/restyle/components/Button.tsx.ejs +0 -40
  78. package/build/templates/packages/restyle/components/Container.tsx.ejs +0 -6
  79. package/build/templates/packages/restyle/components/EditScreenInfo.tsx.ejs +0 -29
  80. package/build/templates/packages/restyle/components/ScreenContent.tsx.ejs +0 -21
  81. package/build/templates/packages/restyle/theme/Box.tsx.ejs +0 -6
  82. package/build/templates/packages/restyle/theme/Text.tsx.ejs +0 -6
  83. package/build/templates/packages/restyle/theme/index.ts.ejs +0 -6
  84. package/build/templates/packages/restyle/theme/theme.ts.ejs +0 -67
  85. package/build/templates/packages/tamagui/components/BackButton.tsx.ejs +0 -19
  86. package/build/templates/packages/tamagui/components/Button.tsx.ejs +0 -18
  87. package/build/templates/packages/tamagui/components/Container.tsx.ejs +0 -6
  88. package/build/templates/packages/tamagui/components/EditScreenInfo.tsx.ejs +0 -29
  89. package/build/templates/packages/tamagui/components/ScreenContent.tsx.ejs +0 -23
  90. package/build/templates/packages/tamagui/tamagui.config.ts.ejs +0 -130
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "extends": "expo/tsconfig.base",
3
3
  "compilerOptions": {
4
- "strict": true,
5
- "jsx": "react-jsx"
6
4
  <% if (props.flags.importAlias) { %>
7
- ,
5
+ "strict": true,
8
6
  "baseUrl": ".",
9
7
  "paths": {
10
8
  <% if (props.stylingPackage?.name === 'nativewindui') { %>
11
- "~/*": [ "./*" ]
9
+ "@/*": [ "./*" ]
12
10
  <% } else { %>
13
11
  <% if (props.navigationPackage?.name === "expo-router" && props.flags.importAlias === true) { %>
14
- "~/*": ["*"]
12
+ "@/*": ["*"]
15
13
  <% } else if (props.flags.importAlias === true) { %>
16
- "~/*": ["src/*"]
14
+ "@/*": ["src/*"]
17
15
  <% } else { %>
18
16
  "<%= props.flags.importAlias %>": ["src/*"]
19
17
  <% } %>
20
18
  <% } %>
21
19
  }
20
+ <% } else { %>
21
+ "strict": true
22
22
  <% } %>
23
23
  <% if (props.navigationPackage?.name === 'expo-router') { %>
24
24
  },
@@ -26,7 +26,12 @@
26
26
  "**/*.ts",
27
27
  "**/*.tsx",
28
28
  ".expo/types/**/*.ts",
29
- "expo-env.d.ts"
29
+ <% if (props.stylingPackage?.name === 'nativewind' || props.stylingPackage?.name === 'nativewindui') { %>
30
+ "expo-env.d.ts",
31
+ "nativewind-env.d.ts"
32
+ <% } else { %>
33
+ "expo-env.d.ts"
34
+ <% } %>
30
35
  ]
31
36
  <% } else { %>
32
37
  }
@@ -11,67 +11,33 @@ import { Link, Stack } from 'expo-router';
11
11
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
12
12
  import { StyleSheet, Text } from 'react-native';
13
13
 
14
- import { Container } from '~/components/Container';
15
- <% } else if (props.stylingPackage?.name === "tamagui") { %>
16
- import { YStack } from "tamagui";
17
- import { Container, Main, Subtitle, Title } from "../tamagui.config";
18
- <% } else if (props.stylingPackage?.name === "restyle") { %>
19
- import { Box, Text, makeStyles } from 'theme';
20
-
21
14
  import { Container } from '~/components/Container';
22
15
  <% } %>
23
16
 
24
17
  export default function NotFoundScreen() {
25
- <% if (props.stylingPackage?.name === "restyle") { %>
26
- const styles = useStyles();
27
- <% } %>
28
18
 
29
19
  return (
30
- <% if (props.stylingPackage?.name === "nativewind") {%>
31
- <>
32
- <Stack.Screen options={{ title: "Oops!" }} />
33
- <Container>
34
- <Text className={styles.title}>{"This screen doesn't exist."}</Text>
35
- <Link href="/" className={styles.link}>
36
- <Text className={styles.linkText}>Go to home screen!</Text>
37
- </Link>
38
- </Container>
39
- </>
40
- <% } else if (props.stylingPackage?.name === "tamagui") {%>
20
+ <% if (props.stylingPackage?.name === "nativewind") {%>
21
+ <>
22
+ <Stack.Screen options={{ title: "Oops!" }} />
23
+ <Container>
24
+ <Text className={styles.title}>{"This screen doesn't exist."}</Text>
25
+ <Link href="/" className={styles.link}>
26
+ <Text className={styles.linkText}>Go to home screen!</Text>
27
+ </Link>
28
+ </Container>
29
+ </>
30
+ <% } else { %>
31
+ <>
32
+ <Stack.Screen options={{ title: "Oops!" }} />
41
33
  <Container>
42
- <Stack.Screen options={{ title: "Oops!" }} />
43
- <Main>
44
- <YStack>
45
- <Title>{"This screen doesn't exist."}</Title>
46
- <Link href="/">
47
- <Subtitle>Go to home screen!</Subtitle>
48
- </Link>
49
- </YStack>
50
- </Main>
34
+ <Text style={styles.title}>{"This screen doesn't exist."}</Text>
35
+ <Link href="/" style={styles.link}>
36
+ <Text style={styles.linkText}>Go to home screen!</Text>
37
+ </Link>
51
38
  </Container>
52
- <% } else if (props.stylingPackage?.name === "restyle") {%>
53
- <>
54
- <Stack.Screen options={{ title: 'Oops!' }} />
55
- <Container>
56
- <Text variant="title">{"This screen doesn't exist."}</Text>
57
- <Link href="/" style={styles.link}>
58
- <Text variant="body" color="blue">
59
- Go to home screen!
60
- </Text>
61
- </Link>
62
- </Container>
63
- </>
64
- <% } else { %>
65
- <>
66
- <Stack.Screen options={{ title: "Oops!" }} />
67
- <Container>
68
- <Text style={styles.title}>{"This screen doesn't exist."}</Text>
69
- <Link href="/" style={styles.link}>
70
- <Text style={styles.linkText}>Go to home screen!</Text>
71
- </Link>
72
- </Container>
73
- </>
74
- <% } %>
39
+ </>
40
+ <% } %>
75
41
  );
76
42
  }
77
43
 
@@ -112,11 +78,4 @@ export default function NotFoundScreen() {
112
78
  color: '#2e78b7',
113
79
  },
114
80
  });
115
- <% } else if (props.stylingPackage?.name === "restyle") { %>
116
- const useStyles = makeStyles((theme) => ({
117
- link: {
118
- marginTop: theme.spacing.m_16,
119
- paddingVertical: theme.spacing.m_16,
120
- },
121
- }));
122
81
  <% } %>
@@ -13,23 +13,8 @@ import 'react-native-gesture-handler';
13
13
  import { GestureHandlerRootView } from 'react-native-gesture-handler';
14
14
  import { Stack } from 'expo-router';
15
15
 
16
- <% if (props.stylingPackage?.name==="tamagui" ) { %>
17
- import React, { useEffect } from "react";
18
- import { TamaguiProvider } from 'tamagui'
19
- import { SplashScreen } from "expo-router";
20
- import { useFonts } from "expo-font";
21
-
22
- import config from '../tamagui.config';
23
-
24
- SplashScreen.preventAutoHideAsync();
25
- <% } else if (props.stylingPackage?.name === "restyle") { %>
26
- import { ThemeProvider } from '@shopify/restyle';
27
-
28
- import { theme } from '../theme';
29
- <% } %>
30
-
31
16
  <% if (props.stylingPackage?.name === "unistyles") { %>
32
- import { useUnistyles } from "react-native-unistyles";
17
+ import { useUnistyles } from "react-native-unistyles";
33
18
  <% } %>
34
19
 
35
20
  <% if (props.analyticsPackage?.name === "vexo-analytics") { %>
@@ -44,30 +29,11 @@ export const unstable_settings = {
44
29
  };
45
30
 
46
31
  export default function RootLayout() {
47
- <% if (props.stylingPackage?.name==="tamagui" ) { %>
48
- const [loaded] = useFonts({
49
- Inter: require("@tamagui/font-inter/otf/Inter-Medium.otf"),
50
- InterBold: require("@tamagui/font-inter/otf/Inter-Bold.otf")
51
- });
52
-
53
- useEffect(() => {
54
- if (loaded) {
55
- SplashScreen.hideAsync();
56
- }
57
- }, [loaded]);
58
-
59
- if (!loaded) return null;
60
- <% } %>
61
32
  <% if (props.stylingPackage?.name === "unistyles") { %>
62
33
  const { theme } = useUnistyles();
63
34
  <% } %>
64
35
 
65
- return (
66
- <% if (props.stylingPackage?.name === "tamagui") { %>
67
- <TamaguiProvider config={config}>
68
- <% } else if (props.stylingPackage?.name === "restyle") { %>
69
- <ThemeProvider theme={theme}>
70
- <% } %>
36
+ return (
71
37
  <GestureHandlerRootView style={{ flex: 1 }}>
72
38
  <% if (props.stylingPackage?.name === "unistyles") { %>
73
39
  <Stack
@@ -95,10 +61,5 @@ export default function RootLayout() {
95
61
  <Stack.Screen name="modal" options={{ title: 'Modal', presentation: 'modal' }} />
96
62
  </Stack>
97
63
  </GestureHandlerRootView>
98
- <% if (props.stylingPackage?.name === "tamagui") { %>
99
- </TamaguiProvider>
100
- <% } else if (props.stylingPackage?.name === "restyle") { %>
101
- </ThemeProvider>
102
- <% } %>
103
64
  );
104
65
  }
@@ -1,7 +1,7 @@
1
1
  // Learn more https://docs.expo.io/guides/customizing-metro
2
2
  const { getDefaultConfig } = require('expo/metro-config');
3
3
  <% if (["nativewind", "nativewindui"].includes(props.stylingPackage?.name)) { %>
4
- const { withNativeWind } = require("nativewind/metro");
4
+ const { withNativewind } = require("nativewind/metro");
5
5
  <% } %>
6
6
 
7
7
  /** @type {import('expo/metro-config').MetroConfig} */
@@ -9,9 +9,9 @@ const { getDefaultConfig } = require('expo/metro-config');
9
9
  const config = getDefaultConfig(__dirname);
10
10
 
11
11
  <% if (props.stylingPackage?.name === "nativewind") { %>
12
- module.exports = withNativeWind(config, { input: "./global.css" });
12
+ module.exports = withNativewind(config);
13
13
  <% } else if (props.stylingPackage?.name === "nativewindui") { %>
14
- module.exports = withNativeWind(config, { input: "./global.css", inlineRem: 16 });
14
+ module.exports = withNativewind(config, { inlineRem: 16 });
15
15
  <% } else { %>
16
16
  module.exports = config;
17
17
  <% } %>
@@ -1,88 +1,61 @@
1
1
  import { Link, Stack } from 'expo-router';
2
2
  <% if (props.stylingPackage?.name === "nativewind") {%>
3
- import { Text } from 'react-native';
3
+ import { Text, View } from 'react-native';
4
4
 
5
- import { Container } from '~/components/Container';
6
5
  <% } else if (props.stylingPackage?.name === "unistyles") { %>
7
6
  import { StyleSheet } from 'react-native-unistyles'
8
- import { Text } from 'react-native';
7
+ import { Text, View } from 'react-native';
9
8
 
10
- import { Container } from '~/components/Container';
11
9
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
12
- import { StyleSheet, Text } from 'react-native';
10
+ import { StyleSheet, Text, View } from 'react-native';
13
11
 
14
- import { Container } from '~/components/Container';
15
- <% } else if (props.stylingPackage?.name === "tamagui") { %>
16
- import { YStack } from "tamagui";
17
- import { Container, Main, Subtitle, Title } from "../tamagui.config";
18
- <% } else if (props.stylingPackage?.name === "restyle") { %>
19
- import { Box, Text, makeStyles } from 'theme';
20
-
21
- import { Container } from '~/components/Container';
22
12
  <% } %>
23
13
 
24
14
  export default function NotFoundScreen() {
25
- <% if (props.stylingPackage?.name === "restyle") { %>
26
- const styles = useStyles();
27
- <% } %>
28
15
 
29
16
  return (
30
- <% if (props.stylingPackage?.name === "nativewind") {%>
31
- <>
32
- <Stack.Screen options={{ title: "Oops!" }} />
33
- <Container>
34
- <Text className={styles.title}>{"This screen doesn't exist."}</Text>
35
- <Link href="/" className={styles.link}>
36
- <Text className={styles.linkText}>Go to home screen!</Text>
37
- </Link>
38
- </Container>
39
- </>
40
- <% } else if (props.stylingPackage?.name === "tamagui") {%>
41
- <Container>
42
- <Stack.Screen options={{ title: "Oops!" }} />
43
- <Main>
44
- <YStack>
45
- <Title>{"This screen doesn't exist."}</Title>
46
- <Link href="/">
47
- <Subtitle>Go to home screen!</Subtitle>
48
- </Link>
49
- </YStack>
50
- </Main>
51
- </Container>
52
- <% } else if (props.stylingPackage?.name === "restyle") {%>
53
- <>
54
- <Stack.Screen options={{ title: 'Oops!' }} />
55
- <Box flex={1} justifyContent="center" alignItems="center" padding="ml_24">
56
- <Text variant="title">{"This screen doesn't exist."}</Text>
57
- <Link href="/" style={styles.link}>
58
- <Text variant="body" color="blue">
59
- Go to home screen!
60
- </Text>
61
- </Link>
62
- </Box>
63
- </>
64
- <% } else { %>
65
- <>
66
- <Stack.Screen options={{ title: "Oops!" }} />
67
- <Container>
68
- <Text style={styles.title}>{"This screen doesn't exist."}</Text>
69
- <Link href="/" style={styles.link}>
70
- <Text style={styles.linkText}>Go to home screen!</Text>
71
- </Link>
72
- </Container>
73
- </>
74
- <% } %>
17
+ <% if (props.stylingPackage?.name === "nativewind") { %>
18
+ <View className={styles.container}>
19
+ <Stack.Screen options={{ title: "Oops!" }} />
20
+ <View className={styles.contentContainer}>
21
+ <Text className={styles.title}>{"This screen doesn't exist."}</Text>
22
+ <Link href="/" className={styles.link}>
23
+ <Text className={styles.linkText}>Go to home screen!</Text>
24
+ </Link>
25
+ </View>
26
+ </View>
27
+ <% } else { %>
28
+ <View style={styles.container}>
29
+ <Stack.Screen options={{ title: "Oops!" }} />
30
+ <View style={styles.contentContainer}>
31
+ <Text style={styles.title}>{"This screen doesn't exist."}</Text>
32
+ <Link href="/" style={styles.link}>
33
+ <Text style={styles.linkText}>Go to home screen!</Text>
34
+ </Link>
35
+ </View>
36
+ </View>
37
+ <% } %>
75
38
  );
76
39
  }
77
40
 
78
41
  <% if (props.stylingPackage?.name === "nativewind") { %>
79
42
  const styles = {
43
+ container: `flex flex-1 bg-white`,
44
+ contentContainer: `flex flex-1 m-6`,
80
45
  title: `text-xl font-bold`,
81
46
  link: `mt-4 pt-4`,
82
47
  linkText: `text-base text-[#2e78b7]`,
83
48
  };
84
49
  <% } else if (props.stylingPackage?.name === "unistyles") { %>
85
50
  const styles = StyleSheet.create((theme) => ({
51
+ container: {
52
+ flex: 1,
53
+ backgroundColor: 'white',
54
+ },
55
+ contentContainer: {
56
+ flex: 1,
57
+ margin: 24,
58
+ },
86
59
  title: {
87
60
  fontSize: 20,
88
61
  fontWeight: 'bold',
@@ -99,6 +72,14 @@ const styles = StyleSheet.create((theme) => ({
99
72
  }));
100
73
  <% } else if (props.stylingPackage?.name === "stylesheet") { %>
101
74
  const styles = StyleSheet.create({
75
+ container: {
76
+ flex: 1,
77
+ backgroundColor: 'white',
78
+ },
79
+ contentContainer: {
80
+ flex: 1,
81
+ margin: 24,
82
+ },
102
83
  title: {
103
84
  fontSize: 20,
104
85
  fontWeight: 'bold',
@@ -112,11 +93,4 @@ const styles = StyleSheet.create({
112
93
  color: '#2e78b7',
113
94
  },
114
95
  });
115
- <% } else if (props.stylingPackage?.name === "restyle") { %>
116
- const useStyles = makeStyles((theme) => ({
117
- link: {
118
- marginTop: theme.spacing.m_16,
119
- paddingVertical: theme.spacing.m_16,
120
- },
121
- }));
122
96
  <% } %>
@@ -8,18 +8,6 @@
8
8
  <% if (props.internalizationPackage?.name === "i18next") { %>
9
9
  import '../translation';
10
10
  <% } %>
11
-
12
- <% if (props.stylingPackage?.name === "tamagui") { %>
13
- import { useFonts } from 'expo-font';
14
- import { SplashScreen, Stack } from 'expo-router';
15
- import { useEffect } from 'react';
16
- import { TamaguiProvider } from 'tamagui';
17
-
18
- import config from '../tamagui.config';
19
- <% } else if (props.stylingPackage?.name === "restyle") { %>
20
- import { ThemeProvider } from '@shopify/restyle';
21
- import { theme } from 'theme';
22
- <% } %>
23
11
  import { Stack } from "expo-router";
24
12
 
25
13
  <% if (props.analyticsPackage?.name === "vexo-analytics") { %>
@@ -32,46 +20,27 @@ export default function Layout() {
32
20
  <% if (props.stylingPackage?.name === "unistyles") { %>
33
21
  const { theme } = useUnistyles();
34
22
  <% } %>
35
- <% if (props.stylingPackage?.name === "tamagui") { %>
36
- const [loaded] = useFonts({
37
- Inter: require("@tamagui/font-inter/otf/Inter-Medium.otf"),
38
- InterBold: require("@tamagui/font-inter/otf/Inter-Bold.otf")
39
- });
40
-
41
- useEffect(() => {
42
- if (loaded) {
43
- SplashScreen.hideAsync();
44
- }
45
- }, [loaded]);
46
-
47
- if (!loaded) return null;
48
- <% } %>
49
23
 
50
24
  return (
51
- <% if (props.stylingPackage?.name === "tamagui") { %>
52
- <TamaguiProvider config={config}>
53
- <% } else if (props.stylingPackage?.name === "restyle") { %>
54
- <ThemeProvider theme={theme}>
55
- <% } %>
56
- <% if (props.stylingPackage?.name === "unistyles") { %>
57
- <Stack
58
- screenOptions={{
59
- headerStyle: {
60
- backgroundColor: theme.colors.background,
61
- },
62
- headerTitleStyle: {
63
- color: theme.colors.typography,
64
- },
65
- headerTintColor: theme.colors.typography
66
- }}
67
- />
68
- <% } else { %>
69
- <Stack />
70
- <% } %>
71
- <% if (props.stylingPackage?.name === "tamagui") { %>
72
- </TamaguiProvider>
73
- <% } else if (props.stylingPackage?.name === "restyle") { %>
74
- </ThemeProvider >
75
- <% } %>
25
+ <% if (props.stylingPackage?.name === "unistyles") { %>
26
+ <Stack
27
+ screenOptions={{
28
+ headerStyle: {
29
+ backgroundColor: theme.colors.background,
30
+ },
31
+ headerTitleStyle: {
32
+ color: theme.colors.typography,
33
+ },
34
+ headerTintColor: theme.colors.typography
35
+ }}
36
+ />
37
+ <% } else if (props.stylingPackage?.name === "nativewind") { %>
38
+ <Stack>
39
+ <Stack.Screen name="index" options={{ title: 'Home' }} />
40
+ <Stack.Screen name="details" options={{ title: 'Details' }} />
41
+ </Stack>
42
+ <% } else { %>
43
+ <Stack />
44
+ <% } %>
76
45
  );
77
46
  }
@@ -1,17 +1,48 @@
1
+ <% if (props.stylingPackage?.name === "stylesheet") { %>
2
+ import { StyleSheet, View } from 'react-native';
3
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
4
+ import { StyleSheet } from 'react-native-unistyles';
5
+ import { View } from 'react-native';
6
+ <% } %>
1
7
  import { Stack, useLocalSearchParams } from 'expo-router';
2
8
 
3
- import { Container } from '~/components/Container';
4
- import { ScreenContent } from '~/components/ScreenContent';
9
+ <% if (props.stylingPackage?.name !== "nativewind") { %>
10
+ import { Container } from '@/components/Container';
11
+ <% } %>
12
+ import { ScreenContent } from '@/components/ScreenContent';
5
13
 
6
14
  export default function Details() {
7
15
  const { name } = useLocalSearchParams();
8
16
 
9
17
  return (
10
- <>
11
- <Stack.Screen options={{ title: 'Details' }} />
12
- <Container>
18
+ <% if (props.stylingPackage?.name === "nativewind") { %>
19
+ <>
20
+ <Stack.Screen options={{ title: 'Details' }} />
13
21
  <ScreenContent path="screens/details.tsx" title={`Showing details for user ${name}`} />
14
- </Container>
15
- </>
22
+ </>
23
+ <% } else { %>
24
+ <View style={styles.container}>
25
+ <Stack.Screen options={{ title: 'Details' }} />
26
+ <Container>
27
+ <ScreenContent path="screens/details.tsx" title={`Showing details for user ${name}`} />
28
+ </Container>
29
+ </View>
30
+ <% } %>
16
31
  );
17
- }
32
+ }
33
+
34
+ <% if (props.stylingPackage?.name === "stylesheet") { %>
35
+ const styles = StyleSheet.create({
36
+ container: {
37
+ flex: 1,
38
+ backgroundColor: 'white',
39
+ },
40
+ });
41
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
42
+ const styles = StyleSheet.create((theme) => ({
43
+ container: {
44
+ flex: 1,
45
+ backgroundColor: 'white',
46
+ },
47
+ }));
48
+ <% } %>
@@ -1,43 +1,91 @@
1
+ <% if (props.stylingPackage?.name === "stylesheet") { %>
2
+ import { StyleSheet, View } from 'react-native';
1
3
  import { Stack, Link } from 'expo-router';
2
-
3
- <% if (props.stylingPackage?.name === "unistyles") { %>
4
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
4
5
  import { StyleSheet } from 'react-native-unistyles';
6
+ import { Stack, Link } from 'expo-router';
7
+ import { View } from 'react-native';
8
+ <% } else { %>
9
+ import { View } from 'react-native';
10
+ import { router } from 'expo-router';
11
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
12
  <% } %>
6
13
 
7
- import { Button } from '~/components/Button';
8
- import { Container } from '~/components/Container';
9
- import { ScreenContent } from '~/components/ScreenContent';
14
+ import { Button } from '@/components/Button';
15
+ <% if (props.stylingPackage?.name !== "nativewind") { %>
16
+ import { Container } from '@/components/Container';
17
+ <% } %>
18
+ import { ScreenContent } from '@/components/ScreenContent';
10
19
 
11
20
  <% if (props.internalizationPackage?.name === "i18next") { %>
12
21
  import { InternalizationExample } from 'components/InternalizationExample';
13
22
  <% } %>
14
23
 
15
24
  export default function Home() {
25
+ <% if (props.stylingPackage?.name === "nativewind") { %>
26
+ const insets = useSafeAreaInsets();
27
+ <% } %>
16
28
  return (
17
- <>
18
- <Stack.Screen options={{ title: 'Home' }} />
19
- <Container>
29
+ <% if (props.stylingPackage?.name === "nativewind") { %>
30
+ <View className="flex-1 px-4 bg-white">
31
+ <% if (props.internalizationPackage?.name === "i18next") { %>
20
32
  <ScreenContent path="app/index.tsx" title="Home">
21
- <% if (props.internalizationPackage?.name === "i18next") { %>
22
33
  <InternalizationExample />
23
- <% } %>
24
34
  </ScreenContent>
25
- <Link href={{ pathname: '/details', params: { name: 'Dan' } }} asChild>
26
- <% if (props.stylingPackage?.name === "unistyles") { %>
27
- <Button title="Show Details" style={styles.button} />
35
+ <% } else { %>
36
+ <ScreenContent path="app/index.tsx" title="Home" />
37
+ <% } %>
38
+ <View className={styles.buttonWrapper} style={{ paddingBottom: insets.bottom }}>
39
+ <Button
40
+ title="Show Details"
41
+ onPress={() => router.push({ pathname: '/details', params: { name: 'Dan' } })}
42
+ />
43
+ </View>
44
+ </View>
45
+ <% } else { %>
46
+ <View style={styles.container}>
47
+ <Stack.Screen options={{ title: 'Home' }} />
48
+ <Container>
49
+ <% if (props.internalizationPackage?.name === "i18next") { %>
50
+ <ScreenContent path="app/index.tsx" title="Home">
51
+ <InternalizationExample />
52
+ </ScreenContent>
28
53
  <% } else { %>
29
- <Button title="Show Details" />
54
+ <ScreenContent path="app/index.tsx" title="Home" />
30
55
  <% } %>
31
- </Link>
32
- </Container>
33
- </>
56
+ <Link href={{ pathname: '/details', params: { name: 'Dan' } }} asChild>
57
+ <% if (props.stylingPackage?.name === "unistyles") { %>
58
+ <Button title="Show Details" style={styles.button} />
59
+ <% } else { %>
60
+ <Button title="Show Details" />
61
+ <% } %>
62
+ </Link>
63
+ </Container>
64
+ </View>
65
+ <% } %>
34
66
  );
35
67
  }
36
68
 
37
- <% if (props.stylingPackage?.name === "unistyles") { %>
69
+ <% if (props.stylingPackage?.name === "nativewind") { %>
70
+ const styles = {
71
+ buttonWrapper: "w-full",
72
+ container: "flex flex-1 bg-white px-4",
73
+ }
74
+ <% } else if (props.stylingPackage?.name === "stylesheet") { %>
75
+ const styles = StyleSheet.create({
76
+ container: {
77
+ flex: 1,
78
+ backgroundColor: 'white',
79
+ },
80
+ });
81
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
38
82
  const styles = StyleSheet.create((theme) => ({
39
- button: {
40
- marginHorizontal: theme.margins.xl,
41
- },
83
+ container: {
84
+ flex: 1,
85
+ backgroundColor: 'white',
86
+ },
87
+ button: {
88
+ marginHorizontal: theme.margins.xl,
89
+ },
42
90
  }));
43
91
  <% } %>