@mr.dj2u/create-expo-stack 2.21.3-mrdj.0

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 (191) hide show
  1. package/README.md +435 -0
  2. package/bin/create-expo-stack.js +2 -0
  3. package/build/cli.js +49 -0
  4. package/build/commands/create-expo-stack.js +471 -0
  5. package/build/constants.js +39 -0
  6. package/build/templates/base/.gitignore.ejs +26 -0
  7. package/build/templates/base/.npmrc.ejs +1 -0
  8. package/build/templates/base/App.tsx.ejs +66 -0
  9. package/build/templates/base/app.json.ejs +69 -0
  10. package/build/templates/base/assets/adaptive-icon.png +0 -0
  11. package/build/templates/base/assets/favicon.png +0 -0
  12. package/build/templates/base/assets/icon.png +0 -0
  13. package/build/templates/base/assets/splash.png +0 -0
  14. package/build/templates/base/babel.config.js.ejs +38 -0
  15. package/build/templates/base/components/BackButton.tsx.ejs +23 -0
  16. package/build/templates/base/components/Button.tsx.ejs +42 -0
  17. package/build/templates/base/components/Container.tsx.ejs +14 -0
  18. package/build/templates/base/components/EditScreenInfo.tsx.ejs +44 -0
  19. package/build/templates/base/components/HeaderButton.tsx.ejs +31 -0
  20. package/build/templates/base/components/ScreenContent.tsx.ejs +40 -0
  21. package/build/templates/base/components/TabBarIcon.tsx.ejs +15 -0
  22. package/build/templates/base/eslint.config.js.ejs +15 -0
  23. package/build/templates/base/package.json.ejs +191 -0
  24. package/build/templates/base/prettier.config.js.ejs +11 -0
  25. package/build/templates/base/tsconfig.json.ejs +39 -0
  26. package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/_layout.tsx.ejs +40 -0
  27. package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/index.tsx.ejs +15 -0
  28. package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/two.tsx.ejs +15 -0
  29. package/build/templates/packages/expo-router/drawer/app/(drawer)/_layout.tsx.ejs +65 -0
  30. package/build/templates/packages/expo-router/drawer/app/(drawer)/index.tsx.ejs +15 -0
  31. package/build/templates/packages/expo-router/drawer/app/+html.tsx.ejs +49 -0
  32. package/build/templates/packages/expo-router/drawer/app/+not-found.tsx.ejs +100 -0
  33. package/build/templates/packages/expo-router/drawer/app/_layout.tsx.ejs +91 -0
  34. package/build/templates/packages/expo-router/drawer/app/modal.tsx.ejs +21 -0
  35. package/build/templates/packages/expo-router/expo-env.d.ts +4 -0
  36. package/build/templates/packages/expo-router/index.js.ejs +4 -0
  37. package/build/templates/packages/expo-router/metro.config.js.ejs +24 -0
  38. package/build/templates/packages/expo-router/stack/app/+html.tsx.ejs +49 -0
  39. package/build/templates/packages/expo-router/stack/app/+not-found.tsx.ejs +113 -0
  40. package/build/templates/packages/expo-router/stack/app/_layout.tsx.ejs +63 -0
  41. package/build/templates/packages/expo-router/stack/app/details.tsx.ejs +56 -0
  42. package/build/templates/packages/expo-router/stack/app/index.tsx.ejs +73 -0
  43. package/build/templates/packages/expo-router/tabs/app/(tabs)/_layout.tsx.ejs +52 -0
  44. package/build/templates/packages/expo-router/tabs/app/(tabs)/index.tsx.ejs +37 -0
  45. package/build/templates/packages/expo-router/tabs/app/(tabs)/two.tsx.ejs +37 -0
  46. package/build/templates/packages/expo-router/tabs/app/+html.tsx.ejs +49 -0
  47. package/build/templates/packages/expo-router/tabs/app/+not-found.tsx.ejs +110 -0
  48. package/build/templates/packages/expo-router/tabs/app/_layout.tsx.ejs +84 -0
  49. package/build/templates/packages/expo-router/tabs/app/modal.tsx.ejs +21 -0
  50. package/build/templates/packages/firebase/.env.ejs +8 -0
  51. package/build/templates/packages/firebase/metro.config.js.ejs +14 -0
  52. package/build/templates/packages/firebase/utils/firebase.ts.ejs +26 -0
  53. package/build/templates/packages/i18next/components/InternalizationExample.tsx.ejs +23 -0
  54. package/build/templates/packages/i18next/core/i18n/fallbackChecker.ts.ejs +13 -0
  55. package/build/templates/packages/i18next/core/i18n/init.ts.ejs +24 -0
  56. package/build/templates/packages/i18next/core/i18n/languageDetector.ts.ejs +13 -0
  57. package/build/templates/packages/i18next/translation/en.json.ejs +8 -0
  58. package/build/templates/packages/i18next/translation/fr.json.ejs +8 -0
  59. package/build/templates/packages/i18next/translation/index.ts.ejs +20 -0
  60. package/build/templates/packages/nativewind/components/BackButton.tsx.ejs +22 -0
  61. package/build/templates/packages/nativewind/components/Button.tsx.ejs +21 -0
  62. package/build/templates/packages/nativewind/components/Container.tsx.ejs +13 -0
  63. package/build/templates/packages/nativewind/components/EditScreenInfo.tsx.ejs +40 -0
  64. package/build/templates/packages/nativewind/components/ScreenContent.tsx.ejs +27 -0
  65. package/build/templates/packages/nativewind/global.css +3 -0
  66. package/build/templates/packages/nativewind/metro.config.js +7 -0
  67. package/build/templates/packages/nativewind/nativewind-env.d.ts +2 -0
  68. package/build/templates/packages/nativewind/tailwind.config.js.ejs +15 -0
  69. package/build/templates/packages/nativewindui/components/Container.tsx.ejs +14 -0
  70. package/build/templates/packages/nativewindui/components/EditScreenInfo.tsx.ejs +45 -0
  71. package/build/templates/packages/nativewindui/components/HeaderButton.tsx.ejs +31 -0
  72. package/build/templates/packages/nativewindui/components/ScreenContent.tsx.ejs +40 -0
  73. package/build/templates/packages/nativewindui/components/TabBarIcon.tsx.ejs +15 -0
  74. package/build/templates/packages/nativewindui/components/nativewindui/Icon/Icon.ios.tsx.ejs +52 -0
  75. package/build/templates/packages/nativewindui/components/nativewindui/Icon/Icon.tsx.ejs +58 -0
  76. package/build/templates/packages/nativewindui/components/nativewindui/Icon/index.ts.ejs +16 -0
  77. package/build/templates/packages/nativewindui/components/nativewindui/Icon/types.ts.ejs +18 -0
  78. package/build/templates/packages/nativewindui/components/nativewindui/ThemeToggle.tsx.ejs +33 -0
  79. package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/_layout.tsx.ejs +28 -0
  80. package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/index.tsx.ejs +15 -0
  81. package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/two.tsx.ejs +15 -0
  82. package/build/templates/packages/nativewindui/drawer/app/(drawer)/_layout.tsx.ejs +35 -0
  83. package/build/templates/packages/nativewindui/drawer/app/(drawer)/index.tsx.ejs +535 -0
  84. package/build/templates/packages/nativewindui/drawer/app/+html.tsx.ejs +46 -0
  85. package/build/templates/packages/nativewindui/drawer/app/+not-found.tsx.ejs +83 -0
  86. package/build/templates/packages/nativewindui/drawer/app/_layout.tsx.ejs +75 -0
  87. package/build/templates/packages/nativewindui/drawer/app/modal.tsx.ejs +33 -0
  88. package/build/templates/packages/nativewindui/global.css.ejs +91 -0
  89. package/build/templates/packages/nativewindui/lib/cn.ts.ejs +6 -0
  90. package/build/templates/packages/nativewindui/lib/useColorScheme.tsx.ejs +21 -0
  91. package/build/templates/packages/nativewindui/nativewind-env.d.ts.ejs +1 -0
  92. package/build/templates/packages/nativewindui/stack/app/+html.tsx.ejs +46 -0
  93. package/build/templates/packages/nativewindui/stack/app/+not-found.tsx.ejs +18 -0
  94. package/build/templates/packages/nativewindui/stack/app/_layout.tsx.ejs +78 -0
  95. package/build/templates/packages/nativewindui/stack/app/index.tsx.ejs +487 -0
  96. package/build/templates/packages/nativewindui/stack/app/modal.tsx.ejs +33 -0
  97. package/build/templates/packages/nativewindui/tabs/app/(tabs)/_layout.tsx.ejs +35 -0
  98. package/build/templates/packages/nativewindui/tabs/app/(tabs)/index.tsx.ejs +537 -0
  99. package/build/templates/packages/nativewindui/tabs/app/(tabs)/two.tsx.ejs +22 -0
  100. package/build/templates/packages/nativewindui/tabs/app/+html.tsx.ejs +46 -0
  101. package/build/templates/packages/nativewindui/tabs/app/+not-found.tsx.ejs +90 -0
  102. package/build/templates/packages/nativewindui/tabs/app/_layout.tsx.ejs +78 -0
  103. package/build/templates/packages/nativewindui/tabs/app/modal.tsx.ejs +21 -0
  104. package/build/templates/packages/nativewindui/tailwind.config.js.ejs +67 -0
  105. package/build/templates/packages/nativewindui/theme/colors.ts.ejs +123 -0
  106. package/build/templates/packages/nativewindui/theme/index.ts.ejs +32 -0
  107. package/build/templates/packages/nativewindui/theme/with-opacity.ts.ejs +155 -0
  108. package/build/templates/packages/react-navigation/App.tsx.ejs +73 -0
  109. package/build/templates/packages/react-navigation/navigation/drawer-navigator.tsx.ejs +31 -0
  110. package/build/templates/packages/react-navigation/navigation/index.tsx.ejs +108 -0
  111. package/build/templates/packages/react-navigation/navigation/tab-navigator.tsx.ejs +38 -0
  112. package/build/templates/packages/react-navigation/screens/details.tsx.ejs +41 -0
  113. package/build/templates/packages/react-navigation/screens/home.tsx.ejs +5 -0
  114. package/build/templates/packages/react-navigation/screens/modal.tsx.ejs +20 -0
  115. package/build/templates/packages/react-navigation/screens/one.tsx.ejs +5 -0
  116. package/build/templates/packages/react-navigation/screens/overview.tsx.ejs +54 -0
  117. package/build/templates/packages/react-navigation/screens/two.tsx.ejs +5 -0
  118. package/build/templates/packages/restyle/components/BackButton.tsx.ejs +19 -0
  119. package/build/templates/packages/restyle/components/Button.tsx.ejs +32 -0
  120. package/build/templates/packages/restyle/components/Container.tsx.ejs +16 -0
  121. package/build/templates/packages/restyle/components/EditScreenInfo.tsx.ejs +38 -0
  122. package/build/templates/packages/restyle/components/ScreenContent.tsx.ejs +30 -0
  123. package/build/templates/packages/restyle/theme.ts.ejs +51 -0
  124. package/build/templates/packages/supabase/.env.ejs +2 -0
  125. package/build/templates/packages/supabase/utils/supabase.ts.ejs +14 -0
  126. package/build/templates/packages/tamagui/components/BackButton.tsx.ejs +12 -0
  127. package/build/templates/packages/tamagui/components/Button.tsx.ejs +17 -0
  128. package/build/templates/packages/tamagui/components/Container.tsx.ejs +12 -0
  129. package/build/templates/packages/tamagui/components/EditScreenInfo.tsx.ejs +27 -0
  130. package/build/templates/packages/tamagui/components/ScreenContent.tsx.ejs +23 -0
  131. package/build/templates/packages/tamagui/tamagui.config.ts.ejs +14 -0
  132. package/build/templates/packages/unistyles/breakpoints.ts.ejs +9 -0
  133. package/build/templates/packages/unistyles/components/BackButton.tsx.ejs +28 -0
  134. package/build/templates/packages/unistyles/components/Button.tsx.ejs +42 -0
  135. package/build/templates/packages/unistyles/components/Container.tsx.ejs +17 -0
  136. package/build/templates/packages/unistyles/components/EditScreenInfo.tsx.ejs +53 -0
  137. package/build/templates/packages/unistyles/components/ScreenContent.tsx.ejs +43 -0
  138. package/build/templates/packages/unistyles/theme.ts.ejs +34 -0
  139. package/build/templates/packages/unistyles/unistyles.ts.ejs +27 -0
  140. package/build/templates/packages/uniwind/global.css +2 -0
  141. package/build/templates/packages/uniwind/metro.config.js.ejs +10 -0
  142. package/build/templates/packages/vexo-analytics/.env.ejs +7 -0
  143. package/build/templates/packages/zustand/store/store.ts.ejs +15 -0
  144. package/build/types/cli.d.ts +4 -0
  145. package/build/types/commands/create-expo-stack.d.ts +3 -0
  146. package/build/types/constants.d.ts +10 -0
  147. package/build/types/types.d.ts +33 -0
  148. package/build/types/utilities/bumpVersion.d.ts +1 -0
  149. package/build/types/utilities/clearNavigationPackages.d.ts +2 -0
  150. package/build/types/utilities/clearStylingPackages.d.ts +2 -0
  151. package/build/types/utilities/configAnalytics.d.ts +18 -0
  152. package/build/types/utilities/configStorage.d.ts +8 -0
  153. package/build/types/utilities/configureProjectFiles.d.ts +3 -0
  154. package/build/types/utilities/copyBaseAssets.d.ts +2 -0
  155. package/build/types/utilities/generateNWUI.d.ts +3 -0
  156. package/build/types/utilities/generateProjectFiles.d.ts +5 -0
  157. package/build/types/utilities/getPackageManager.d.ts +8 -0
  158. package/build/types/utilities/index.d.ts +10 -0
  159. package/build/types/utilities/printOutput.d.ts +3 -0
  160. package/build/types/utilities/publishToGitHub.d.ts +2 -0
  161. package/build/types/utilities/renderTitle.d.ts +2 -0
  162. package/build/types/utilities/runCLI.d.ts +3 -0
  163. package/build/types/utilities/runEasConfigure.d.ts +3 -0
  164. package/build/types/utilities/runIgnite.d.ts +3 -0
  165. package/build/types/utilities/showHelp.d.ts +1 -0
  166. package/build/types/utilities/systemCommand.d.ts +14 -0
  167. package/build/types/utilities/usePackage.d.ts +2 -0
  168. package/build/types/utilities/validateProjectName.d.ts +4 -0
  169. package/build/types.js +39 -0
  170. package/build/utilities/bumpVersion.js +21 -0
  171. package/build/utilities/clearNavigationPackages.js +11 -0
  172. package/build/utilities/clearStylingPackages.js +11 -0
  173. package/build/utilities/configAnalytics.js +70 -0
  174. package/build/utilities/configStorage.js +50 -0
  175. package/build/utilities/configureProjectFiles.js +380 -0
  176. package/build/utilities/copyBaseAssets.js +21 -0
  177. package/build/utilities/generateNWUI.js +54 -0
  178. package/build/utilities/generateProjectFiles.js +106 -0
  179. package/build/utilities/getPackageManager.js +103 -0
  180. package/build/utilities/index.js +27 -0
  181. package/build/utilities/printOutput.js +251 -0
  182. package/build/utilities/publishToGitHub.js +173 -0
  183. package/build/utilities/renderTitle.js +55 -0
  184. package/build/utilities/runCLI.js +437 -0
  185. package/build/utilities/runEasConfigure.js +83 -0
  186. package/build/utilities/runIgnite.js +26 -0
  187. package/build/utilities/showHelp.js +85 -0
  188. package/build/utilities/systemCommand.js +40 -0
  189. package/build/utilities/usePackage.js +8 -0
  190. package/build/utilities/validateProjectName.js +42 -0
  191. package/package.json +77 -0
@@ -0,0 +1,537 @@
1
+ import { Stack } from 'expo-router';
2
+ import { useHeaderHeight } from '@react-navigation/elements';
3
+ import { FlashList } from '@shopify/flash-list';
4
+ import { cssInterop } from 'nativewind';
5
+ import * as React from 'react';
6
+ import {
7
+ <% if (
8
+ props.stylingPackage?.options.selectedComponents.includes('action-sheet') ||
9
+ props.stylingPackage?.options.selectedComponents.includes('activity-view') ||
10
+ props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')
11
+ ) { %>
12
+ Button as RNButton,
13
+ ButtonProps,
14
+ <% } %>
15
+ Linking,
16
+ <% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
17
+ Platform,
18
+ <% } %>
19
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-view')) { %>
20
+ Share,
21
+ <% } %>
22
+ useWindowDimensions,
23
+ View,
24
+ Alert,
25
+ } from 'react-native';
26
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
27
+ <% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
28
+ import { useActionSheet } from '@expo/react-native-action-sheet';
29
+ <% } %>
30
+ import { Icon } from '@roninoss/icons';
31
+ <% if (props.stylingPackage?.options.selectedComponents.includes('ratings-indicator')) { %>
32
+ import * as StoreReview from 'expo-store-review';
33
+ <% } %>
34
+
35
+ import { Container } from '@/components/Container';
36
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-indicator')) { %>
37
+ import { ActivityIndicator } from '@/components/nativewindui/ActivityIndicator';
38
+ <% } %>
39
+ <% if (props.stylingPackage?.options.selectedComponents.includes('avatar')) { %>
40
+ import { Avatar, AvatarFallback, AvatarImage } from '@/components/nativewindui/Avatar';
41
+ <% } %>
42
+ <% if (props.stylingPackage?.options.selectedComponents.includes('date-picker')) { %>
43
+ import { DatePicker } from '@/components/nativewindui/DatePicker';
44
+ <% } %>
45
+ <% if (props.stylingPackage?.options.selectedComponents.includes('picker')) { %>
46
+ import { Picker, PickerItem } from '@/components/nativewindui/Picker';
47
+ <% } %>
48
+ <% if (props.stylingPackage?.options.selectedComponents.includes('progress-indicator')) { %>
49
+ import { ProgressIndicator } from '@/components/nativewindui/ProgressIndicator';
50
+ <% } %>
51
+ <% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
52
+ import { Sheet, useSheetRef } from '@/components/nativewindui/Sheet';
53
+ <% } %>
54
+ <% if (props.stylingPackage?.options.selectedComponents.includes('slider')) { %>
55
+ import { Slider } from '@/components/nativewindui/Slider';
56
+ <% } %>
57
+ import { Text } from '@/components/nativewindui/Text';
58
+ <% if (props.stylingPackage?.options.selectedComponents.includes('toggle')) { %>
59
+ import { Toggle } from '@/components/nativewindui/Toggle';
60
+ <% } %>
61
+ import { useColorScheme } from '@/lib/useColorScheme';
62
+ import { useHeaderSearchBar } from '@/lib/useHeaderSearchBar';
63
+
64
+ export default function Home() {
65
+ const searchValue = useHeaderSearchBar({ hideWhenScrolling: COMPONENTS.length === 0 });
66
+
67
+ const data = searchValue
68
+ ? COMPONENTS.filter((c) => c.name.toLowerCase().includes(searchValue.toLowerCase()))
69
+ : COMPONENTS;
70
+
71
+ return (
72
+ <>
73
+ <Stack.Screen options={{ title: 'Tab One' }} />
74
+ <Container>
75
+ <FlashList
76
+ contentInsetAdjustmentBehavior="automatic"
77
+ keyboardShouldPersistTaps="handled"
78
+ data={data}
79
+ estimatedItemSize={200}
80
+ contentContainerClassName="py-4 android:pb-12"
81
+ extraData={searchValue}
82
+ keyExtractor={keyExtractor}
83
+ ItemSeparatorComponent={renderItemSeparator}
84
+ renderItem={renderItem}
85
+ ListEmptyComponent={COMPONENTS.length === 0 ? ListEmptyComponent : undefined}
86
+ />
87
+ </Container>
88
+ </>
89
+ );
90
+ }
91
+
92
+ cssInterop(FlashList, {
93
+ className: 'style',
94
+ contentContainerClassName: 'contentContainerStyle',
95
+ });
96
+ <% if (
97
+ props.stylingPackage?.options.selectedComponents.includes('action-sheet') ||
98
+ props.stylingPackage?.options.selectedComponents.includes('activity-view') ||
99
+ props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')
100
+ ) { %>
101
+ function DefaultButton({ color, ...props }: ButtonProps) {
102
+ const { colors } = useColorScheme();
103
+ return <RNButton color={color ?? colors.primary} {...props} />;
104
+ }
105
+ <% } %>
106
+
107
+ function ListEmptyComponent() {
108
+ const insets = useSafeAreaInsets();
109
+ const dimensions = useWindowDimensions();
110
+ const headerHeight = useHeaderHeight();
111
+ const { colors } = useColorScheme();
112
+ const height = dimensions.height - headerHeight - insets.bottom - insets.top;
113
+
114
+ return (
115
+ <View style={{ height }} className="flex-1 items-center justify-center gap-1 px-12">
116
+ <Icon name="file-plus-outline" size={42} color={colors.grey} />
117
+ <Text variant='title3' className='pb-1 text-center font-semibold'>
118
+ No Components Installed
119
+ </Text>
120
+ <Text color='tertiary' variant='subhead' className='pb-4 text-center'>
121
+ You can install any of the free components from the{' '}
122
+ <Text
123
+ onPress={() => Linking.openURL('https://nativewindui.com')}
124
+ variant='subhead'
125
+ className='text-primary'
126
+ >
127
+ NativewindUI
128
+ </Text>
129
+ {' website.'}
130
+ </Text>
131
+ </View>
132
+ );
133
+ }
134
+
135
+ type ComponentItem = { name: string; component: React.FC };
136
+
137
+ function keyExtractor(item: ComponentItem) {
138
+ return item.name;
139
+ }
140
+
141
+ function renderItemSeparator() {
142
+ return <View className="p-2" />;
143
+ }
144
+
145
+ function renderItem({ item }: { item: ComponentItem }) {
146
+ return (
147
+ <Card title={item.name}>
148
+ <item.component />
149
+ </Card>
150
+ );
151
+ }
152
+
153
+ function Card({ children, title }: { children: React.ReactNode; title: string }) {
154
+ return (
155
+ <View className="px-4">
156
+ <View className="gap-4 rounded-xl border border-border bg-card p-4 pb-6 shadow-sm shadow-black/10 dark:shadow-none">
157
+ <Text className="text-center text-sm font-medium tracking-wider opacity-60">{title}</Text>
158
+ {children}
159
+ </View>
160
+ </View>
161
+ );
162
+ }
163
+ <% if (props.stylingPackage?.options.selectedComponents.includes('ratings-indicator')) { %>
164
+ let hasRequestedReview = false;
165
+ <% } %>
166
+ const COMPONENTS: ComponentItem[] = [
167
+ <% if (!props.stylingPackage?.options.selectedComponents.length) { %>
168
+ // ADD ANY ADDITIONAL COMPONENTS HERE
169
+ // {
170
+ // name: 'Component Name',
171
+ // component: function ComponentNameExample() {
172
+ // return (
173
+ // <View>
174
+ // <Text>Component Example</Text>
175
+ // </View>
176
+ // );
177
+ // },
178
+ // },
179
+ <% } %>
180
+ <% if (props.stylingPackage?.options.selectedComponents.includes('picker')) { %>
181
+ {
182
+ name: 'Picker',
183
+ component: function PickerExample() {
184
+ const { colors } = useColorScheme();
185
+ const [picker, setPicker] = React.useState('blue');
186
+ return (
187
+ <Picker
188
+ selectedValue={picker}
189
+ onValueChange={(itemValue) => setPicker(itemValue)}
190
+ >
191
+ <PickerItem
192
+ label='Red'
193
+ value='red'
194
+ color={colors.foreground}
195
+ style={{
196
+ backgroundColor: colors.root,
197
+ }}
198
+ />
199
+ <PickerItem
200
+ label='Blue'
201
+ value='blue'
202
+ color={colors.foreground}
203
+ style={{
204
+ backgroundColor: colors.root,
205
+ }}
206
+ />
207
+ <PickerItem
208
+ label='Green'
209
+ value='green'
210
+ color={colors.foreground}
211
+ style={{
212
+ backgroundColor: colors.root,
213
+ }}
214
+ />
215
+ </Picker>
216
+ );
217
+ },
218
+ },
219
+ <% } %>
220
+ <% if (props.stylingPackage?.options.selectedComponents.includes('date-picker')) { %>
221
+ {
222
+ name: 'Date Picker',
223
+ component: function DatePickerExample() {
224
+ const [date, setDate] = React.useState(new Date());
225
+ return (
226
+ <View className='items-center'>
227
+ <DatePicker
228
+ value={date}
229
+ mode='datetime'
230
+ onChange={(ev) => {
231
+ setDate(new Date(ev.nativeEvent.timestamp));
232
+ }}
233
+ />
234
+ </View>
235
+ );
236
+ },
237
+ },
238
+ <% } %>
239
+ <% if (props.stylingPackage?.options.selectedComponents.includes('slider')) { %>
240
+ {
241
+ name: 'Slider',
242
+ component: function SliderExample() {
243
+ const [sliderValue, setSliderValue] = React.useState(0.5);
244
+ return <Slider value={sliderValue} onValueChange={setSliderValue} />;
245
+ },
246
+ },
247
+ <% } %>
248
+ <% if (props.stylingPackage?.options.selectedComponents.includes('toggle')) { %>
249
+ {
250
+ name: 'Toggle',
251
+ component: function ToggleExample() {
252
+ const [switchValue, setSwitchValue] = React.useState(true);
253
+ return (
254
+ <View className='items-center'>
255
+ <Toggle value={switchValue} onValueChange={setSwitchValue} />
256
+ </View>
257
+ );
258
+ }
259
+ },
260
+ <% } %>
261
+ <% if (props.stylingPackage?.options.selectedComponents.includes('progress-indicator')) { %>
262
+ {
263
+ name: 'Progress Indicator',
264
+ component: function ProgressIndicatorExample() {
265
+ const [progress, setProgress] = React.useState(13);
266
+ let id: ReturnType<typeof setInterval> | null = null;
267
+ React.useEffect(() => {
268
+ if (!id) {
269
+ id = setInterval(() => {
270
+ setProgress((prev) => (prev >= 99 ? 0 : prev + 5));
271
+ }, 1000);
272
+ }
273
+ return () => {
274
+ if (id) clearInterval(id);
275
+ };
276
+ }, []);
277
+ return (
278
+ <View className='p-4'>
279
+ <ProgressIndicator value={progress} />
280
+ </View>
281
+ );
282
+ },
283
+ },
284
+ <% } %>
285
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-indicator')) { %>
286
+ {
287
+ name: 'Activity Indicator',
288
+ component: function ActivityIndicatorExample() {
289
+ return (
290
+ <View className='p-4 items-center'>
291
+ <ActivityIndicator />
292
+ </View>
293
+ );
294
+ },
295
+ },
296
+ <% } %>
297
+ <% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
298
+ {
299
+ name: 'Action Sheet',
300
+ component: function ActionSheetExample() {
301
+ const { colorScheme, colors } = useColorScheme();
302
+ const { showActionSheetWithOptions } = useActionSheet();
303
+ return (
304
+ <View className='items-center'>
305
+ <DefaultButton
306
+ color={'grey'}
307
+ onPress={async () => {
308
+ const options = ['Delete', 'Save', 'Cancel'];
309
+ const destructiveButtonIndex = 0;
310
+ const cancelButtonIndex = 2;
311
+
312
+ showActionSheetWithOptions(
313
+ {
314
+ options,
315
+ cancelButtonIndex,
316
+ destructiveButtonIndex,
317
+ containerStyle: {
318
+ backgroundColor: colorScheme === 'dark' ? 'black' : 'white',
319
+ },
320
+ textStyle: {
321
+ color: colors.foreground,
322
+ },
323
+ },
324
+ (selectedIndex) => {
325
+ switch (selectedIndex) {
326
+ case 1:
327
+ // Save
328
+ break;
329
+
330
+ case destructiveButtonIndex:
331
+ // Delete
332
+ break;
333
+
334
+ case cancelButtonIndex:
335
+ // Canceled
336
+ }
337
+ }
338
+ );
339
+ }}
340
+ title='Open action sheet'
341
+ />
342
+ </View>
343
+ );
344
+ },
345
+ },
346
+ <% } %>
347
+ {
348
+ name: 'Text',
349
+ component: function TextExample() {
350
+ return (
351
+ <View className='gap-2'>
352
+ <Text variant='largeTitle' className='text-center'>
353
+ Large Title
354
+ </Text>
355
+ <Text variant='title1' className='text-center'>
356
+ Title 1
357
+ </Text>
358
+ <Text variant='title2' className='text-center'>
359
+ Title 2
360
+ </Text>
361
+ <Text variant='title3' className='text-center'>
362
+ Title 3
363
+ </Text>
364
+ <Text variant='heading' className='text-center'>
365
+ Heading
366
+ </Text>
367
+ <Text variant='body' className='text-center'>
368
+ Body
369
+ </Text>
370
+ <Text variant='callout' className='text-center'>
371
+ Callout
372
+ </Text>
373
+ <Text variant='subhead' className='text-center'>
374
+ Subhead
375
+ </Text>
376
+ <Text variant='footnote' className='text-center'>
377
+ Footnote
378
+ </Text>
379
+ <Text variant='caption1' className='text-center'>
380
+ Caption 1
381
+ </Text>
382
+ <Text variant='caption2' className='text-center'>
383
+ Caption 2
384
+ </Text>
385
+ </View>
386
+ );
387
+ },
388
+ },
389
+ {
390
+ name: 'Selectable Text',
391
+ component: function SelectableTextExample() {
392
+ return (
393
+ <Text uiTextView selectable>
394
+ Long press or double press this text
395
+ </Text>
396
+ );
397
+ },
398
+ },
399
+ <% if (props.stylingPackage?.options.selectedComponents.includes('ratings-indicator')) { %>
400
+ {
401
+ name: 'Ratings Indicator',
402
+ component: function RatingsIndicatorExample() {
403
+ React.useEffect(() => {
404
+ async function showRequestReview() {
405
+ if (hasRequestedReview) return;
406
+ try {
407
+ if (await StoreReview.hasAction()) {
408
+ await StoreReview.requestReview();
409
+ }
410
+ } catch (error) {
411
+ console.log(
412
+ 'FOR ANDROID: Make sure you meet all conditions to be able to test and use it: https://developer.android.com/guide/playcore/in-app-review/test#troubleshooting',
413
+ error
414
+ );
415
+ } finally {
416
+ hasRequestedReview = true;
417
+ }
418
+ }
419
+ const timeout = setTimeout(() => {
420
+ showRequestReview();
421
+ }, 1000);
422
+
423
+ return () => clearTimeout(timeout);
424
+ }, []);
425
+
426
+ return (
427
+ <View className="gap-3">
428
+ <Text className="pb-2 text-center font-semibold">Please follow the guidelines.</Text>
429
+ <View className="flex-row">
430
+ <Text className="w-6 text-center text-muted-foreground">·</Text>
431
+ <View className="flex-1">
432
+ <Text variant="caption1" className="text-muted-foreground">
433
+ Do not call StoreReview.requestReview() from a button
434
+ </Text>
435
+ </View>
436
+ </View>
437
+ <View className="flex-row">
438
+ <Text className="w-6 text-center text-muted-foreground">·</Text>
439
+ <View className="flex-1">
440
+ <Text variant="caption1" className="text-muted-foreground">
441
+ Do not request a review when the user is doing something time sensitive.
442
+ </Text>
443
+ </View>
444
+ </View>
445
+ <View className="flex-row">
446
+ <Text className="w-6 text-center text-muted-foreground">·</Text>
447
+ <View className="flex-1">
448
+ <Text variant="caption1" className="text-muted-foreground">
449
+ Do not ask the user any questions before or while presenting the rating button or
450
+ card.
451
+ </Text>
452
+ </View>
453
+ </View>
454
+ </View>
455
+ );
456
+ },
457
+ },
458
+ <% } %>
459
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-view')) { %>
460
+ {
461
+ name: 'Activity View',
462
+ component: function ActivityViewExample() {
463
+ return (
464
+ <View className='items-center'>
465
+ <DefaultButton
466
+ onPress={async () => {
467
+ try {
468
+ const result = await Share.share({
469
+ message: 'NativewindUI | Familiar interface, native feel.',
470
+ });
471
+ if (result.action === Share.sharedAction) {
472
+ if (result.activityType) {
473
+ // shared with activity type of result.activityType
474
+ } else {
475
+ // shared
476
+ }
477
+ } else if (result.action === Share.dismissedAction) {
478
+ // dismissed
479
+ }
480
+ } catch (error: any) {
481
+ Alert.alert(error.message);
482
+ }
483
+ }}
484
+ title='Share a message'
485
+ />
486
+ </View>
487
+ );
488
+ },
489
+ },
490
+ <% } %>
491
+ <% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
492
+ {
493
+ name: 'Bottom Sheet',
494
+ component: function BottomSheetExample() {
495
+ const { colorScheme } = useColorScheme();
496
+ const bottomSheetModalRef = useSheetRef();
497
+
498
+ return (
499
+ <View className='items-center'>
500
+ <DefaultButton
501
+ color={
502
+ colorScheme === 'dark' && Platform.OS === 'ios'
503
+ ? 'white'
504
+ : 'black'
505
+ }
506
+ title='Open Bottom Sheet'
507
+ onPress={() => bottomSheetModalRef.current?.present()}
508
+ />
509
+ <Sheet ref={bottomSheetModalRef} snapPoints={[200]}>
510
+ <View className='flex-1 justify-center items-center pb-8'>
511
+ <Text>@gorhom/bottom-sheet 🎉</Text>
512
+ </View>
513
+ </Sheet>
514
+ </View>
515
+ );
516
+ },
517
+ },
518
+ <% } %>
519
+ <% if (props.stylingPackage?.options.selectedComponents.includes('avatar')) { %>
520
+ {
521
+ name: 'Avatar',
522
+ component: function AvatarExample() {
523
+ const TWITTER_AVATAR_URI = 'https://pbs.twimg.com/profile_images/1782428433898708992/1voyv4_A_400x400.jpg';
524
+ return (
525
+ <View className='items-center'>
526
+ <Avatar alt="NativewindUI Avatar">
527
+ <AvatarImage source={{ uri: TWITTER_AVATAR_URI }} />
528
+ <AvatarFallback>
529
+ <Text>NUI</Text>
530
+ </AvatarFallback>
531
+ </Avatar>
532
+ </View>
533
+ );
534
+ },
535
+ },
536
+ <% } %>
537
+ ];
@@ -0,0 +1,22 @@
1
+ import { Stack } from 'expo-router';
2
+ import { StyleSheet, View } from 'react-native';
3
+
4
+ import { ScreenContent } from '@/components/ScreenContent';
5
+
6
+ export default function Home() {
7
+ return (
8
+ <>
9
+ <Stack.Screen options={{ title: 'Tab Two' }} />
10
+ <View style={styles.container}>
11
+ <ScreenContent path="app/(tabs)/two.tsx" title="Tab Two" />
12
+ </View>
13
+ </>
14
+ );
15
+ }
16
+
17
+ const styles = StyleSheet.create({
18
+ container: {
19
+ flex: 1,
20
+ padding: 24,
21
+ },
22
+ });
@@ -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,90 @@
1
+ import { Link, Stack } from 'expo-router';
2
+ <% if (["nativewind", "nativewindui"].includes(props.stylingPackage?.name)) {%>
3
+ import { Text, View } from 'react-native';
4
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
5
+ import { createStyleSheet, useStyles } from 'react-native-unistyles'
6
+ import { Text, View } from 'react-native';
7
+ <% } else if (props.stylingPackage?.name === "stylesheet") { %>
8
+ import { StyleSheet, Text, View } from 'react-native';
9
+ <% } %>
10
+
11
+ export default function NotFoundScreen() {
12
+ <% if (props.stylingPackage?.name === "unistyles") {%>
13
+ const { styles } = useStyles(stylesheet);
14
+ <% } %>
15
+
16
+ return (
17
+ <% if (["nativewind", "nativewindui"].includes(props.stylingPackage?.name)) {%>
18
+ <>
19
+ <Stack.Screen options={{ title: "Oops!" }} />
20
+ <View className={styles.container}>
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
+ </>
27
+ <% } else { %>
28
+ <>
29
+ <Stack.Screen options={{ title: "Oops!" }} />
30
+ <View style={styles.container}>
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
+ </>
37
+ <% } %>
38
+ );
39
+ }
40
+
41
+ <% if (["nativewind", "nativewindui"].includes(props.stylingPackage?.name)) { %>
42
+ const styles = {
43
+ container: `items-center flex-1 justify-center p-5`,
44
+ title: `text-xl font-bold`,
45
+ link: `mt-4 pt-4`,
46
+ linkText: `text-base text-[#2e78b7]`,
47
+ };
48
+ <% } else if (props.stylingPackage?.name === "unistyles") { %>
49
+ const stylesheet = createStyleSheet((theme) => ({
50
+ container: {
51
+ flex: 1,
52
+ alignItems: 'center',
53
+ justifyContent: 'center',
54
+ padding: 20,
55
+ },
56
+ title: {
57
+ fontSize: 20,
58
+ fontWeight: 'bold',
59
+ },
60
+ link: {
61
+ marginTop: 16,
62
+ paddingVertical: 16,
63
+ },
64
+ linkText: {
65
+ fontSize: 14,
66
+ color: theme.colors.astral,
67
+ },
68
+ }));
69
+ <% } else if (props.stylingPackage?.name === "stylesheet") { %>
70
+ const styles = StyleSheet.create({
71
+ container: {
72
+ flex: 1,
73
+ alignItems: 'center',
74
+ justifyContent: 'center',
75
+ padding: 20,
76
+ },
77
+ title: {
78
+ fontSize: 20,
79
+ fontWeight: 'bold',
80
+ },
81
+ link: {
82
+ marginTop: 16,
83
+ paddingVertical: 16,
84
+ },
85
+ linkText: {
86
+ fontSize: 14,
87
+ color: '#2e78b7',
88
+ },
89
+ });
90
+ <% } %>