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