create-expo-stack 2.9.10 → 2.10.0-next.14c795f

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 (40) hide show
  1. package/README.md +6 -6
  2. package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/_layout.tsx.ejs +0 -1
  3. package/build/templates/packages/expo-router/drawer/app/(drawer)/index.tsx.ejs +1 -2
  4. package/build/templates/packages/expo-router/metro.config.js.ejs +4 -3
  5. package/build/templates/packages/expo-router/stack/app/_layout.tsx.ejs +1 -3
  6. package/build/templates/packages/nativewindui/components/BackButton.tsx.ejs +23 -0
  7. package/build/templates/packages/nativewindui/components/Button.tsx.ejs +40 -0
  8. package/build/templates/packages/nativewindui/components/Container.tsx.ejs +13 -0
  9. package/build/templates/packages/nativewindui/components/EditScreenInfo.tsx.ejs +55 -0
  10. package/build/templates/packages/nativewindui/components/HeaderButton.tsx.ejs +29 -0
  11. package/build/templates/packages/nativewindui/components/ScreenContent.tsx.ejs +38 -0
  12. package/build/templates/packages/nativewindui/components/TabBarIcon.tsx.ejs +15 -0
  13. package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/_layout.tsx.ejs +28 -0
  14. package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/index.tsx.ejs +714 -0
  15. package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/two.tsx.ejs +15 -0
  16. package/build/templates/packages/nativewindui/drawer/app/(drawer)/_layout.tsx.ejs +35 -0
  17. package/build/templates/packages/nativewindui/drawer/app/(drawer)/index.tsx.ejs +15 -0
  18. package/build/templates/packages/nativewindui/drawer/app/+html.tsx.ejs +46 -0
  19. package/build/templates/packages/nativewindui/drawer/app/+not-found.tsx.ejs +123 -0
  20. package/build/templates/packages/nativewindui/drawer/app/_layout.tsx.ejs +73 -0
  21. package/build/templates/packages/nativewindui/stack/app/+html.tsx.ejs +46 -0
  22. package/build/templates/packages/nativewindui/stack/app/modal.tsx.ejs +33 -0
  23. package/build/templates/packages/nativewindui/tabs/app/(tabs)/_layout.tsx.ejs +35 -0
  24. package/build/templates/packages/nativewindui/tabs/app/(tabs)/index.tsx.ejs +713 -0
  25. package/build/templates/packages/nativewindui/tabs/app/(tabs)/two.tsx.ejs +22 -0
  26. package/build/templates/packages/nativewindui/tabs/app/+html.tsx.ejs +46 -0
  27. package/build/templates/packages/nativewindui/tabs/app/+not-found.tsx.ejs +130 -0
  28. package/build/templates/packages/nativewindui/tabs/app/_layout.tsx.ejs +68 -0
  29. package/build/templates/packages/nativewindui/tabs/app/modal.tsx.ejs +21 -0
  30. package/build/utilities/configStorage.js +1 -1
  31. package/build/utilities/configureProjectFiles.js +52 -15
  32. package/build/utilities/generateProjectFiles.js +13 -15
  33. package/build/utilities/runCLI.js +114 -121
  34. package/package.json +69 -67
  35. package/build/templates/packages/nativewindui/expo-env.d.ts.ejs +0 -3
  36. package/build/templates/packages/nativewindui/metro.config.js.ejs +0 -10
  37. /package/build/templates/packages/nativewindui/{app → drawer/app}/modal.tsx.ejs +0 -0
  38. /package/build/templates/packages/nativewindui/{app → stack/app}/+not-found.tsx.ejs +0 -0
  39. /package/build/templates/packages/nativewindui/{app → stack/app}/_layout.tsx.ejs +0 -0
  40. /package/build/templates/packages/nativewindui/{app → stack/app}/index.tsx.ejs +0 -0
@@ -0,0 +1,15 @@
1
+ import { Stack } from 'expo-router';
2
+
3
+ import { Container } from '~/components/Container';
4
+ import { ScreenContent } from '~/components/ScreenContent';
5
+
6
+ export default function Home() {
7
+ return (
8
+ <>
9
+ <Stack.Screen options={{ title: 'Tab Two' }} />
10
+ <Container>
11
+ <ScreenContent path="app/(drawer)/(tabs)/two.tsx" title="Tab Two" />
12
+ </Container>
13
+ </>
14
+ );
15
+ }
@@ -0,0 +1,35 @@
1
+ import { Ionicons, MaterialIcons } from '@expo/vector-icons';
2
+ import { Link } from 'expo-router';
3
+ import { Drawer } from 'expo-router/drawer';
4
+
5
+ import { HeaderButton } from '../../components/HeaderButton';
6
+
7
+ const DrawerLayout = () => (
8
+ <Drawer>
9
+ <Drawer.Screen
10
+ name="index"
11
+ options={{
12
+ headerTitle: 'Home',
13
+ drawerLabel: 'Home',
14
+ drawerIcon: ({ size, color }) => <Ionicons name="home-outline" size={size} color={color} />,
15
+ }}
16
+ />
17
+ <Drawer.Screen
18
+ name="(tabs)"
19
+ options={{
20
+ headerTitle: 'Tabs',
21
+ drawerLabel: 'Tabs',
22
+ drawerIcon: ({ size, color }) => (
23
+ <MaterialIcons name="border-bottom" size={size} color={color} />
24
+ ),
25
+ headerRight: () => (
26
+ <Link href="/modal" asChild>
27
+ <HeaderButton />
28
+ </Link>
29
+ ),
30
+ }}
31
+ />
32
+ </Drawer>
33
+ );
34
+
35
+ export default DrawerLayout;
@@ -0,0 +1,15 @@
1
+ import { Stack } from 'expo-router';
2
+
3
+ import { Container } from '~/components/Container';
4
+ import { ScreenContent } from '~/components/ScreenContent';
5
+
6
+ export default function Home() {
7
+ return (
8
+ <>
9
+ <Stack.Screen options={{ title: 'Home' }} />
10
+ <Container>
11
+ <ScreenContent path="app/(drawer)/index.tsx" title="Home" />
12
+ </Container>
13
+ </>
14
+ );
15
+ }
@@ -0,0 +1,46 @@
1
+ import { ScrollViewStyleReset } from 'expo-router/html';
2
+
3
+ // This file is web-only and used to configure the root HTML for every
4
+ // web page during static rendering.
5
+ // The contents of this function only run in Node.js environments and
6
+ // do not have access to the DOM or browser APIs.
7
+ export default function Root({ children }: { children: React.ReactNode }) {
8
+ return (
9
+ <html lang="en">
10
+ <head>
11
+ <meta charSet="utf-8" />
12
+ <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
13
+
14
+ {/*
15
+ This viewport disables scaling which makes the mobile website act more like a native app.
16
+ However this does reduce built-in accessibility. If you want to enable scaling, use this instead:
17
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
18
+ */}
19
+ <meta
20
+ name="viewport"
21
+ content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1.00001,viewport-fit=cover"
22
+ />
23
+ {/*
24
+ Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
25
+ However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
26
+ */}
27
+ <ScrollViewStyleReset />
28
+
29
+ {/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
30
+ <style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
31
+ {/* Add any additional <head> elements that you want globally available on web... */}
32
+ </head>
33
+ <body>{children}</body>
34
+ </html>
35
+ );
36
+ }
37
+
38
+ const responsiveBackground = `
39
+ body {
40
+ background-color: #fff;
41
+ }
42
+ @media (prefers-color-scheme: dark) {
43
+ body {
44
+ background-color: #000;
45
+ }
46
+ }`;
@@ -0,0 +1,123 @@
1
+ import { Link, Stack } from 'expo-router';
2
+ <% if (props.stylingPackage?.name === "nativewind") {%>
3
+ import { Text } from 'react-native';
4
+
5
+ import { Container } from '~/components/Container';
6
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
7
+ import { createStyleSheet, useStyles } from 'react-native-unistyles'
8
+ import { Text } from 'react-native';
9
+
10
+ import { Container } from '~/components/Container';
11
+ <% } else if (props.stylingPackage?.name === "stylesheet") { %>
12
+ import { StyleSheet, Text } from 'react-native';
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
+ import { Container } from '~/components/Container';
22
+ <% } %>
23
+
24
+ export default function NotFoundScreen() {
25
+ <% if (props.stylingPackage?.name === "restyle") { %>
26
+ const styles = useStyles();
27
+ <% } else if (props.stylingPackage?.name === "unistyles") {%>
28
+ const { styles } = useStyles(stylesheet);
29
+ <% } %>
30
+
31
+ return (
32
+ <% if (props.stylingPackage?.name === "nativewind") {%>
33
+ <>
34
+ <Stack.Screen options={{ title: "Oops!" }} />
35
+ <Container>
36
+ <Text className={styles.title}>This screen doesn't exist.</Text>
37
+ <Link href="/" className={styles.link}>
38
+ <Text className={styles.linkText}>Go to home screen!</Text>
39
+ </Link>
40
+ </Container>
41
+ </>
42
+ <% } else if (props.stylingPackage?.name === "tamagui") {%>
43
+ <Container>
44
+ <Stack.Screen options={{ title: "Oops!" }} />
45
+ <Main>
46
+ <YStack>
47
+ <Title>This screen doesn't exist.</Title>
48
+ <Link href="/">
49
+ <Subtitle>Go to home screen!</Subtitle>
50
+ </Link>
51
+ </YStack>
52
+ </Main>
53
+ </Container>
54
+ <% } else if (props.stylingPackage?.name === "restyle") {%>
55
+ <>
56
+ <Stack.Screen options={{ title: 'Oops!' }} />
57
+ <Container>
58
+ <Text variant="title">This screen doesn't exist.</Text>
59
+ <Link href="/" style={styles.link}>
60
+ <Text variant="body" color="blue">
61
+ Go to home screen!
62
+ </Text>
63
+ </Link>
64
+ </Container>
65
+ </>
66
+ <% } else { %>
67
+ <>
68
+ <Stack.Screen options={{ title: "Oops!" }} />
69
+ <Container>
70
+ <Text style={styles.title}>This screen doesn't exist.</Text>
71
+ <Link href="/" style={styles.link}>
72
+ <Text style={styles.linkText}>Go to home screen!</Text>
73
+ </Link>
74
+ </Container>
75
+ </>
76
+ <% } %>
77
+ );
78
+ }
79
+
80
+ <% if (props.stylingPackage?.name === "nativewind") { %>
81
+ const styles = {
82
+ title: `text-xl font-bold`,
83
+ link: `mt-4 pt-4`,
84
+ linkText: `text-base text-[#2e78b7]`,
85
+ };
86
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
87
+ const stylesheet = createStyleSheet((theme) => ({
88
+ title: {
89
+ fontSize: 20,
90
+ fontWeight: 'bold',
91
+ },
92
+ link: {
93
+ marginTop: 16,
94
+ paddingVertical: 16,
95
+ },
96
+ linkText: {
97
+ fontSize: 14,
98
+ color: theme.colors.astral,
99
+ },
100
+ }));
101
+ <% } else if (props.stylingPackage?.name === "stylesheet") { %>
102
+ const styles = StyleSheet.create({
103
+ title: {
104
+ fontSize: 20,
105
+ fontWeight: 'bold',
106
+ },
107
+ link: {
108
+ marginTop: 16,
109
+ paddingVertical: 16,
110
+ },
111
+ linkText: {
112
+ fontSize: 14,
113
+ color: '#2e78b7',
114
+ },
115
+ });
116
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
117
+ const useStyles = makeStyles((theme) => ({
118
+ link: {
119
+ marginTop: theme.spacing.m_16,
120
+ paddingVertical: theme.spacing.m_16,
121
+ },
122
+ }));
123
+ <% } %>
@@ -0,0 +1,73 @@
1
+ <% if (props.stylingPackage?.name === "nativewind") { %>
2
+ import '../global.css';
3
+ <% } else if (props.stylingPackage?.name === "nativewinui") { %>
4
+ import '../global.css';
5
+ import 'expo-dev-client';
6
+ <% } %>
7
+ <% if (props.stylingPackage?.name === "unistyles") { %>
8
+ import '../unistyles';
9
+ <% } %>
10
+
11
+ <% if (props.internalizationPackage?.name === "i18next") { %>
12
+ import '../translation';
13
+ <% } %>
14
+
15
+ import 'react-native-gesture-handler';
16
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
17
+ import { Stack } from 'expo-router';
18
+
19
+ <% if (props.stylingPackage?.name==="tamagui" ) { %>
20
+ import React, { useEffect } from "react";
21
+ import { TamaguiProvider } from 'tamagui'
22
+ import { SplashScreen } from "expo-router";
23
+ import { useFonts } from "expo-font";
24
+
25
+ import config from '../tamagui.config';
26
+
27
+ SplashScreen.preventAutoHideAsync();
28
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
29
+ import { ThemeProvider } from '@shopify/restyle';
30
+
31
+ import { theme } from '../theme';
32
+ <% } %>
33
+
34
+ export const unstable_settings = {
35
+ // Ensure that reloading on `/modal` keeps a back button present.
36
+ initialRouteName: "(drawer)",
37
+ };
38
+
39
+ export default function RootLayout() {
40
+ <% if (props.stylingPackage?.name==="tamagui" ) { %>
41
+ const [loaded] = useFonts({
42
+ Inter: require("@tamagui/font-inter/otf/Inter-Medium.otf"),
43
+ InterBold: require("@tamagui/font-inter/otf/Inter-Bold.otf")
44
+ });
45
+
46
+ useEffect(() => {
47
+ if (loaded) {
48
+ SplashScreen.hideAsync();
49
+ }
50
+ }, [loaded]);
51
+
52
+ if (!loaded) return null;
53
+ <% } %>
54
+
55
+ return (
56
+ <% if (props.stylingPackage?.name === "tamagui") { %>
57
+ <TamaguiProvider config={config}>
58
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
59
+ <ThemeProvider theme={theme}>
60
+ <% } %>
61
+ <GestureHandlerRootView style={{ flex: 1 }}>
62
+ <Stack>
63
+ <Stack.Screen name="(drawer)" options={{ headerShown: false }} />
64
+ <Stack.Screen name="modal" options={{ title: 'Modal', presentation: 'modal' }} />
65
+ </Stack>
66
+ </GestureHandlerRootView>
67
+ <% if (props.stylingPackage?.name === "tamagui") { %>
68
+ </TamaguiProvider>
69
+ <% } else if (props.stylingPackage?.name === "restyle") { %>
70
+ </ThemeProvider>
71
+ <% } %>
72
+ );
73
+ }
@@ -0,0 +1,46 @@
1
+ import { ScrollViewStyleReset } from 'expo-router/html';
2
+
3
+ // This file is web-only and used to configure the root HTML for every
4
+ // web page during static rendering.
5
+ // The contents of this function only run in Node.js environments and
6
+ // do not have access to the DOM or browser APIs.
7
+ export default function Root({ children }: { children: React.ReactNode }) {
8
+ return (
9
+ <html lang="en">
10
+ <head>
11
+ <meta charSet="utf-8" />
12
+ <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
13
+
14
+ {/*
15
+ This viewport disables scaling which makes the mobile website act more like a native app.
16
+ However this does reduce built-in accessibility. If you want to enable scaling, use this instead:
17
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
18
+ */}
19
+ <meta
20
+ name="viewport"
21
+ content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1.00001,viewport-fit=cover"
22
+ />
23
+ {/*
24
+ Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
25
+ However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
26
+ */}
27
+ <ScrollViewStyleReset />
28
+
29
+ {/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
30
+ <style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
31
+ {/* Add any additional <head> elements that you want globally available on web... */}
32
+ </head>
33
+ <body>{children}</body>
34
+ </html>
35
+ );
36
+ }
37
+
38
+ const responsiveBackground = `
39
+ body {
40
+ background-color: #fff;
41
+ }
42
+ @media (prefers-color-scheme: dark) {
43
+ body {
44
+ background-color: #000;
45
+ }
46
+ }`;
@@ -0,0 +1,33 @@
1
+ import { Icon } from '@roninoss/icons';
2
+ import { StatusBar } from 'expo-status-bar';
3
+ import { Linking, Platform, View } from 'react-native';
4
+
5
+ import { Text } from '~/components/nativewindui/Text';
6
+ import { useColorScheme } from '~/lib/useColorScheme';
7
+
8
+ export default function ModalScreen() {
9
+ const { colors, colorScheme } = useColorScheme();
10
+ return (
11
+ <>
12
+ <StatusBar
13
+ style={Platform.OS === 'ios' ? 'light' : colorScheme === 'dark' ? 'light' : 'dark'}
14
+ />
15
+ <View className="flex-1 items-center justify-center gap-1 px-12">
16
+ <Icon name="file-plus-outline" size={42} color={colors.grey} />
17
+ <Text variant="title3" className="pb-1 text-center font-semibold">
18
+ NativeWindUI
19
+ </Text>
20
+ <Text color="tertiary" variant="subhead" className="pb-4 text-center">
21
+ You can install any of the free components from the{' '}
22
+ <Text
23
+ onPress={() => Linking.openURL('https://nativewindui.com')}
24
+ variant="subhead"
25
+ className="text-primary">
26
+ NativeWindUI
27
+ </Text>
28
+ {' website.'}
29
+ </Text>
30
+ </View>
31
+ </>
32
+ );
33
+ }
@@ -0,0 +1,35 @@
1
+ import { Link, Tabs } from "expo-router";
2
+ import { HeaderButton } from '../../components/HeaderButton';
3
+ import { TabBarIcon } from '../../components/TabBarIcon';
4
+
5
+
6
+
7
+ export default function TabLayout() {
8
+ return (
9
+ <Tabs
10
+ screenOptions={{
11
+ tabBarActiveTintColor: 'black',
12
+ }}>
13
+ <Tabs.Screen
14
+ name='index'
15
+ options={{
16
+ title: 'Tab One',
17
+ tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
18
+ headerRight: () => (
19
+ <Link href='/modal' asChild>
20
+ <HeaderButton />
21
+ </Link>
22
+ ),
23
+ }}
24
+ />
25
+ <Tabs.Screen
26
+ name="two"
27
+ options={{
28
+ title: 'Tab Two',
29
+ tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
30
+ }}
31
+ />
32
+ </Tabs>
33
+ );
34
+ }
35
+