create-expo-stack 2.7.0-next.0c1b767 → 2.7.0-next.12e942e

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 (35) hide show
  1. package/README.md +7 -7
  2. package/build/commands/create-expo-stack.js +41 -2
  3. package/build/templates/base/app.json.ejs +5 -1
  4. package/build/templates/base/package.json.ejs +29 -2
  5. package/build/templates/packages/nativewindui/app/_layout.tsx.ejs +21 -15
  6. package/build/templates/packages/nativewindui/app/index.tsx.ejs +630 -22
  7. package/build/templates/packages/nativewindui/app/modal.tsx.ejs +20 -19
  8. package/build/templates/packages/nativewindui/components/nativewind-ui/ActivityIndicator.tsx.ejs +10 -0
  9. package/build/templates/packages/nativewindui/components/nativewind-ui/Avatar.tsx.ejs +139 -0
  10. package/build/templates/packages/nativewindui/components/nativewind-ui/DatePicker.android.tsx.ejs +66 -0
  11. package/build/templates/packages/nativewindui/components/nativewind-ui/DatePicker.tsx.ejs +10 -0
  12. package/build/templates/packages/nativewindui/components/nativewind-ui/Picker.tsx.ejs +39 -0
  13. package/build/templates/packages/nativewindui/components/nativewind-ui/ProgressIndicator.tsx.ejs +95 -0
  14. package/build/templates/packages/nativewindui/components/nativewind-ui/SegmentedControl.tsx.ejs +22 -0
  15. package/build/templates/packages/nativewindui/components/nativewind-ui/Sheet.tsx.ejs +59 -0
  16. package/build/templates/packages/nativewindui/components/nativewind-ui/Slider.tsx.ejs +28 -0
  17. package/build/templates/packages/nativewindui/components/nativewind-ui/Text.tsx.ejs +25 -1
  18. package/build/templates/packages/nativewindui/components/{ThemeToggle.tsx.ejs → nativewind-ui/ThemeToggle.tsx.ejs} +3 -5
  19. package/build/templates/packages/nativewindui/components/nativewind-ui/Toggle.tsx.ejs +17 -0
  20. package/build/templates/packages/nativewindui/global.css.ejs +2 -2
  21. package/build/types/types.d.ts +2 -0
  22. package/build/types/utilities/clearNavigationPackages.d.ts +2 -0
  23. package/build/utilities/clearNavigationPackages.js +11 -0
  24. package/build/utilities/configureProjectFiles.js +64 -34
  25. package/build/utilities/runCLI.js +80 -26
  26. package/package.json +1 -1
  27. package/build/templates/packages/nativewindui/app/bottom-tabs/_layout.tsx.ejs +0 -34
  28. package/build/templates/packages/nativewindui/app/bottom-tabs/index.tsx.ejs +0 -11
  29. package/build/templates/packages/nativewindui/app/bottom-tabs/profile.tsx.ejs +0 -11
  30. package/build/templates/packages/nativewindui/app/drawer/_layout.tsx.ejs +0 -29
  31. package/build/templates/packages/nativewindui/app/drawer/index.tsx.ejs +0 -11
  32. package/build/templates/packages/nativewindui/app/top-tabs/_layout.tsx.ejs +0 -71
  33. package/build/templates/packages/nativewindui/app/top-tabs/following.tsx.ejs +0 -13
  34. package/build/templates/packages/nativewindui/app/top-tabs/index.tsx.ejs +0 -13
  35. package/build/templates/packages/nativewindui/app/top-tabs/my-group.tsx.ejs +0 -13
@@ -2,24 +2,96 @@ import { useHeaderHeight } from '@react-navigation/elements';
2
2
  import { FlashList } from '@shopify/flash-list';
3
3
  import { cssInterop } from 'nativewind';
4
4
  import * as React from 'react';
5
- import { Button as RNButton, ButtonProps, Linking, View, Platform } from 'react-native';
5
+ import {
6
+ <% if (props.stylingPackage?.options.selectedComponents.includes('alert')) { %>
7
+ Alert,
8
+ <% } %>
9
+ <% if (
10
+ props.stylingPackage?.options.selectedComponents.includes('alert') ||
11
+ props.stylingPackage?.options.selectedComponents.includes('action-sheet') ||
12
+ props.stylingPackage?.options.selectedComponents.includes('activity-view') ||
13
+ props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')
14
+ ) { %>
15
+ Button as RNButton,
16
+ ButtonProps,
17
+ <% } %>
18
+ Linking,
19
+ <% if (props.stylingPackage?.options.selectedComponents.includes('alert') || props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
20
+ Platform,
21
+ <% } %>
22
+ <% if (props.stylingPackage?.options.selectedComponents.includes('dropdown-menu')) { %>
23
+ Pressable,
24
+ <% } %>
25
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-view')) { %>
26
+ Share,
27
+ <% } %>
28
+ useWindowDimensions,
29
+ View,
30
+ } from 'react-native';
31
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
32
+ <% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
33
+ import { useActionSheet } from '@expo/react-native-action-sheet';
34
+ <% } %>
35
+ import { Icon } from '@roninoss/icons';
36
+ <% if (props.stylingPackage?.options.selectedComponents.includes('ratings-indicator')) { %>
37
+ import * as StoreReview from 'expo-store-review';
38
+ <% } %>
39
+ <% if (props.stylingPackage?.options.selectedComponents.includes('context-menu')) { %>
40
+ import * as ContextMenu from 'zeego/context-menu';
41
+ <% } %>
42
+ <% if (props.stylingPackage?.options.selectedComponents.includes('dropdown-menu')) { %>
43
+ import * as DropdownMenu from 'zeego/dropdown-menu';
44
+ <% } %>
6
45
 
46
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-indicator')) { %>
47
+ import { ActivityIndicator } from '~/components/nativewind-ui/ActivityIndicator';
48
+ <% } %>
49
+ <% if (props.stylingPackage?.options.selectedComponents.includes('avatar')) { %>
50
+ import { Avatar, AvatarFallback, AvatarImage } from '~/components/nativewind-ui/Avatar';
51
+ <% } %>
52
+ <% if (props.stylingPackage?.options.selectedComponents.includes('date-picker')) { %>
53
+ import { DatePicker } from '~/components/nativewind-ui/DatePicker';
54
+ <% } %>
55
+ <% if (props.stylingPackage?.options.selectedComponents.includes('picker')) { %>
56
+ import { Picker, PickerItem } from '~/components/nativewind-ui/Picker';
57
+ <% } %>
58
+ <% if (props.stylingPackage?.options.selectedComponents.includes('progress-indicator')) { %>
59
+ import { ProgressIndicator } from '~/components/nativewind-ui/ProgressIndicator';
60
+ <% } %>
61
+ <% if (props.stylingPackage?.options.selectedComponents.includes('segmented-control')) { %>
62
+ import { SegmentedControl } from '~/components/nativewind-ui/SegmentedControl';
63
+ <% } %>
64
+ <% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
65
+ import { Sheet, useSheetRef } from '~/components/nativewind-ui/Sheet';
66
+ <% } %>
67
+ <% if (props.stylingPackage?.options.selectedComponents.includes('slider')) { %>
68
+ import { Slider } from '~/components/nativewind-ui/Slider';
69
+ <% } %>
7
70
  import { Text } from '~/components/nativewind-ui/Text';
71
+ <% if (props.stylingPackage?.options.selectedComponents.includes('toggle')) { %>
72
+ import { Toggle } from '~/components/nativewind-ui/Toggle';
73
+ <% } %>
8
74
  import { useColorScheme } from '~/lib/useColorScheme';
9
75
  import { useHeaderSearchBar } from '~/lib/useHeaderSearchBar';
10
76
 
77
+
11
78
  cssInterop(FlashList, {
12
79
  className: 'style',
13
80
  contentContainerClassName: 'contentContainerStyle',
14
81
  });
15
-
82
+ <% if (
83
+ props.stylingPackage?.options.selectedComponents.includes('alert') ||
84
+ props.stylingPackage?.options.selectedComponents.includes('action-sheet') ||
85
+ props.stylingPackage?.options.selectedComponents.includes('activity-view') ||
86
+ props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')
87
+ ) { %>
16
88
  function DefaultButton({ color, ...props }: ButtonProps) {
17
89
  const { colors } = useColorScheme();
18
90
  return <RNButton color={color ?? colors.primary} {...props} />;
19
91
  }
20
-
92
+ <% } %>
21
93
  export default function Screen() {
22
- const searchValue = useHeaderSearchBar();
94
+ const searchValue = useHeaderSearchBar({ hideWhenScrolling: COMPONENTS.length === 0 });
23
95
 
24
96
  const data = searchValue
25
97
  ? COMPONENTS.filter((c) => c.name.toLowerCase().includes(searchValue.toLowerCase()))
@@ -32,41 +104,47 @@ export default function Screen() {
32
104
  data={data}
33
105
  estimatedItemSize={200}
34
106
  contentContainerClassName="py-4"
35
- centerContent={data.length === 0}
36
107
  extraData={searchValue}
108
+ <% if (props.stylingPackage?.options.selectedComponents.includes('selectable-text')) { %>
37
109
  removeClippedSubviews={false} // used for selecting text on android
110
+ <% } %>
38
111
  keyExtractor={keyExtractor}
39
112
  ItemSeparatorComponent={renderItemSeparator}
40
113
  renderItem={renderItem}
41
- ListEmptyComponent={ListEmptyComponent}
114
+ ListEmptyComponent={COMPONENTS.length === 0 ? ListEmptyComponent : undefined}
42
115
  />
43
116
  );
44
117
  }
45
118
 
46
- const SEARCH_BAR_HEIGHT = 52;
47
-
48
119
  function ListEmptyComponent() {
120
+ const insets = useSafeAreaInsets();
121
+ const dimensions = useWindowDimensions();
49
122
  const headerHeight = useHeaderHeight();
123
+ const { colors } = useColorScheme();
124
+ const height = dimensions.height - headerHeight - insets.bottom - insets.top;
125
+
50
126
  return (
51
- <>
52
- {Platform.OS === 'ios' && <View style={{ height: headerHeight + SEARCH_BAR_HEIGHT }} />}
53
- <View className="flex-1 items-center justify-center px-4">
54
- <Text variant="title3" className="pb-1 text-center font-bold">
55
- Add Components
127
+ <View style={{ height }} className="flex-1 items-center justify-center gap-1 px-12">
128
+ <Icon name="file-plus-outline" size={42} color={colors.grey} />
129
+ <Text variant='title3' className='pb-1 text-center font-semibold'>
130
+ No Components Installed
56
131
  </Text>
57
- <Text color="tertiary" variant="body" className="pb-4 text-center">
58
- You can install any of the free components from the NativeWindUI website.
132
+ <Text color='tertiary' variant='subhead' className='pb-4 text-center'>
133
+ You can install any of the free components from the{' '}
134
+ <Text
135
+ onPress={() => Linking.openURL('https://nativewindui.com')}
136
+ variant='subhead'
137
+ className='text-primary'
138
+ >
139
+ NativeWindUI
140
+ </Text>
141
+ {' website.'}
59
142
  </Text>
60
- <DefaultButton
61
- title="Open NativeWindUI"
62
- onPress={() => Linking.openURL('https://nativewindui.com')}
63
- />
64
143
  </View>
65
- </>
66
144
  );
67
145
  }
68
146
 
69
- type ComponentItem = { name: string; component: () => React.JSX.Element };
147
+ type ComponentItem = { name: string; component: React.FC };
70
148
 
71
149
  function keyExtractor(item: ComponentItem) {
72
150
  return item.name;
@@ -94,6 +172,536 @@ function Card({ children, title }: { children: React.ReactNode; title: string })
94
172
  </View>
95
173
  );
96
174
  }
175
+ <% if (props.stylingPackage?.options.selectedComponents.includes('ratings-indicator')) { %>
176
+ let hasRequestedReview = false;
177
+ <% } %>
178
+ const COMPONENTS: ComponentItem[] = [
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('segmented-control')) { %>
239
+ {
240
+ name: 'Segmented Controls',
241
+ component: function SegmentedControlsExample() {
242
+ const [segment, setSegment] = React.useState(0);
243
+ return (
244
+ <SegmentedControl
245
+ values={['red', 'green', 'blue']}
246
+ selectedIndex={segment}
247
+ onChange={(event) => {
248
+ setSegment(event.nativeEvent.selectedSegmentIndex);
249
+ }}
250
+ />
251
+ );
252
+ },
253
+ },
254
+ <% } %>
255
+ <% if (props.stylingPackage?.options.selectedComponents.includes('slider')) { %>
256
+ {
257
+ name: 'Slider',
258
+ component: function SliderExample() {
259
+ const [sliderValue, setSliderValue] = React.useState(0.5);
260
+ return <Slider value={sliderValue} onValueChange={setSliderValue} />;
261
+ },
262
+ },
263
+ <% } %>
264
+ <% if (props.stylingPackage?.options.selectedComponents.includes('toggle')) { %>
265
+ {
266
+ name: 'Toggle',
267
+ component: function ToggleExample() {
268
+ const [switchValue, setSwitchValue] = React.useState(true);
269
+ return (
270
+ <View className='items-center'>
271
+ <Toggle value={switchValue} onValueChange={setSwitchValue} />
272
+ </View>
273
+ );
274
+ }
275
+ },
276
+ <% } %>
277
+ <% if (props.stylingPackage?.options.selectedComponents.includes('context-menu')) { %>
278
+ {
279
+ name: 'Context Menu',
280
+ component: function ContextMenuExample() {
281
+ const [isChecked, setIsChecked] = React.useState(true);
282
+ return (
283
+ <View>
284
+ <ContextMenu.Root style={{ borderRadius: 12 }}>
285
+ <ContextMenu.Trigger>
286
+ <View className='w-full h-36 rounded-xl border border-foreground border-dashed justify-center items-center'>
287
+ <Text>Press and hold me</Text>
288
+ </View>
289
+ </ContextMenu.Trigger>
290
+ <ContextMenu.Content>
291
+ <ContextMenu.Label children='Label 1' />
292
+ <ContextMenu.Item key='item-1'>
293
+ <ContextMenu.ItemTitle>Item 1</ContextMenu.ItemTitle>
294
+ </ContextMenu.Item>
295
+ <ContextMenu.Group>
296
+ <ContextMenu.Item key='item-2'>
297
+ <ContextMenu.ItemTitle>Item 2</ContextMenu.ItemTitle>
298
+ </ContextMenu.Item>
299
+ <ContextMenu.CheckboxItem
300
+ key='checkbox-example'
301
+ value={isChecked}
302
+ onValueChange={(val) => {
303
+ setIsChecked(val === 'on');
304
+ }}
305
+ >
306
+ <ContextMenu.ItemTitle>Item 3</ContextMenu.ItemTitle>
307
+ <ContextMenu.ItemIndicator />
308
+ </ContextMenu.CheckboxItem>
309
+ </ContextMenu.Group>
310
+ <ContextMenu.Separator />
311
+ </ContextMenu.Content>
312
+ </ContextMenu.Root>
313
+ </View>
314
+ );
315
+ },
316
+ },
317
+ <% } %>
318
+ <% if (props.stylingPackage?.options.selectedComponents.includes('dropdown-menu')) { %>
319
+ {
320
+ name: 'Dropdown Menu',
321
+ component: function DropdownMenuExample() {
322
+ const { colors } = useColorScheme();
323
+ const [menu, setMenu] = React.useState<'primary' | 'destructive'>('primary');
324
+
325
+ return (
326
+ <View className='items-center'>
327
+ <DropdownMenu.Root>
328
+ <DropdownMenu.Trigger>
329
+ <Pressable className='flex-row items-center gap-1.5 android:gap-3'>
330
+ <Text>
331
+ Selected: <Text style={{ color: colors[menu] }}>{menu}</Text>
332
+ </Text>
333
+ <View className='pl-0.5 opacity-70'>
334
+ <Icon
335
+ name='chevron-down'
336
+ color={colors.foreground}
337
+ size={21}
338
+ />
339
+ </View>
340
+ </Pressable>
341
+ </DropdownMenu.Trigger>
342
+ <DropdownMenu.Content>
343
+ <DropdownMenu.CheckboxItem
344
+ key='destructive'
345
+ value={menu === 'destructive'}
346
+ onValueChange={() => {
347
+ setMenu('destructive');
348
+ }}
349
+ >
350
+ <DropdownMenu.ItemIndicator />
351
+ <DropdownMenu.ItemTitle children='destructive' />
352
+ </DropdownMenu.CheckboxItem>
353
+ <DropdownMenu.CheckboxItem
354
+ key='primary'
355
+ value={menu === 'primary'}
356
+ onValueChange={() => {
357
+ setMenu('primary');
358
+ }}
359
+ >
360
+ <DropdownMenu.ItemIndicator />
361
+ <DropdownMenu.ItemTitle children='primary' />
362
+ </DropdownMenu.CheckboxItem>
363
+ </DropdownMenu.Content>
364
+ </DropdownMenu.Root>
365
+ </View>
366
+ );
367
+ },
368
+ },
369
+ <% } %>
370
+ <% if (props.stylingPackage?.options.selectedComponents.includes('progress-indicator')) { %>
371
+ {
372
+ name: 'Progress Indicator',
373
+ component: function ProgressIndicatorExample() {
374
+ const [progress, setProgress] = React.useState(13);
375
+ let id: ReturnType<typeof setInterval> | null = null;
376
+ React.useEffect(() => {
377
+ if (!id) {
378
+ id = setInterval(() => {
379
+ setProgress((prev) => (prev >= 99 ? 0 : prev + 5));
380
+ }, 1000);
381
+ }
382
+ return () => {
383
+ if (id) clearInterval(id);
384
+ };
385
+ }, []);
386
+ return (
387
+ <View className='p-4'>
388
+ <ProgressIndicator value={progress} />
389
+ </View>
390
+ );
391
+ },
392
+ },
393
+ <% } %>
394
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-indicator')) { %>
395
+ {
396
+ name: 'Activity Indicator',
397
+ component: function ActivityIndicatorExample() {
398
+ return (
399
+ <View className='p-4 items-center'>
400
+ <ActivityIndicator />
401
+ </View>
402
+ );
403
+ },
404
+ },
405
+ <% } %>
406
+ <% if (props.stylingPackage?.options.selectedComponents.includes('alert')) { %>
407
+ {
408
+ name: 'Alert',
409
+ component: function AlertExample() {
410
+ const { colors } = useColorScheme();
411
+ return (
412
+ <View className='items-center'>
413
+ <DefaultButton
414
+ color={colors.destructive}
415
+ onPress={() => {
416
+ if (Platform.OS === 'ios') {
417
+ Alert.prompt(
418
+ 'Delete account?',
419
+ 'Enter your password to delete your account.',
420
+ [
421
+ {
422
+ text: 'Cancel',
423
+ onPress: () => console.log('Cancel Pressed'),
424
+ style: 'cancel',
425
+ },
426
+ {
427
+ text: 'Delete',
428
+ style: 'destructive',
429
+ onPress: () => console.log('Delete Pressed'),
430
+ },
431
+ ],
432
+ 'secure-text',
433
+ '',
434
+ 'default'
435
+ );
436
+ } else {
437
+ Alert.alert(
438
+ 'Delete account?',
439
+ 'Enter your password to delete your account.',
440
+ [
441
+ {
442
+ text: 'Cancel',
443
+ onPress: () => console.log('Cancel Pressed'),
444
+ style: 'cancel',
445
+ },
446
+ {
447
+ text: 'Delete',
448
+ style: 'destructive',
449
+ onPress: () => console.log('Delete Pressed'),
450
+ },
451
+ ]
452
+ );
453
+ }
454
+ }}
455
+ title='Delete account'
456
+ />
457
+ </View>
458
+ );
459
+ },
460
+ },
461
+ <% } %>
462
+ <% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
463
+ {
464
+ name: 'Action Sheet',
465
+ component: function ActionSheetExample() {
466
+ const { colorScheme, colors } = useColorScheme();
467
+ const { showActionSheetWithOptions } = useActionSheet();
468
+ return (
469
+ <View className='items-center'>
470
+ <DefaultButton
471
+ color={'grey'}
472
+ onPress={async () => {
473
+ const options = ['Delete', 'Save', 'Cancel'];
474
+ const destructiveButtonIndex = 0;
475
+ const cancelButtonIndex = 2;
476
+
477
+ showActionSheetWithOptions(
478
+ {
479
+ options,
480
+ cancelButtonIndex,
481
+ destructiveButtonIndex,
482
+ containerStyle: {
483
+ backgroundColor: colorScheme === 'dark' ? 'black' : 'white',
484
+ },
485
+ textStyle: {
486
+ color: colors.foreground,
487
+ },
488
+ },
489
+ (selectedIndex) => {
490
+ switch (selectedIndex) {
491
+ case 1:
492
+ // Save
493
+ break;
494
+
495
+ case destructiveButtonIndex:
496
+ // Delete
497
+ break;
498
+
499
+ case cancelButtonIndex:
500
+ // Canceled
501
+ }
502
+ }
503
+ );
504
+ }}
505
+ title='Open action sheet'
506
+ />
507
+ </View>
508
+ );
509
+ },
510
+ },
511
+ <% } %>
512
+ <% if (props.stylingPackage?.options.selectedComponents.includes('text')) { %>
513
+ {
514
+ name: 'Text',
515
+ component: function TextExample() {
516
+ return (
517
+ <View className='gap-2'>
518
+ <Text variant='largeTitle' className='text-center'>
519
+ Large Title
520
+ </Text>
521
+ <Text variant='title1' className='text-center'>
522
+ Title 1
523
+ </Text>
524
+ <Text variant='title2' className='text-center'>
525
+ Title 2
526
+ </Text>
527
+ <Text variant='title3' className='text-center'>
528
+ Title 3
529
+ </Text>
530
+ <Text variant='heading' className='text-center'>
531
+ Heading
532
+ </Text>
533
+ <Text variant='body' className='text-center'>
534
+ Body
535
+ </Text>
536
+ <Text variant='callout' className='text-center'>
537
+ Callout
538
+ </Text>
539
+ <Text variant='subhead' className='text-center'>
540
+ Subhead
541
+ </Text>
542
+ <Text variant='footnote' className='text-center'>
543
+ Footnote
544
+ </Text>
545
+ <Text variant='caption1' className='text-center'>
546
+ Caption 1
547
+ </Text>
548
+ <Text variant='caption2' className='text-center'>
549
+ Caption 2
550
+ </Text>
551
+ </View>
552
+ );
553
+ },
554
+ },
555
+ <% } %>
556
+ <% if (props.stylingPackage?.options.selectedComponents.includes('selectable-text')) { %>
557
+ {
558
+ name: 'Selectable Text',
559
+ component: function SelectableTextExample() {
560
+ return (
561
+ <Text uiTextView selectable>
562
+ Long press or double press this text
563
+ </Text>
564
+ );
565
+ },
566
+ },
567
+ <% } %>
568
+ <% if (props.stylingPackage?.options.selectedComponents.includes('ratings-indicator')) { %>
569
+ {
570
+ name: 'Ratings Indicator',
571
+ component: function RatingsIndicatorExample() {
572
+ React.useEffect(() => {
573
+ async function showRequestReview() {
574
+ if (hasRequestedReview) return;
575
+ try {
576
+ if (await StoreReview.hasAction()) {
577
+ await StoreReview.requestReview();
578
+ }
579
+ } catch (error) {
580
+ console.log(
581
+ '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',
582
+ error
583
+ );
584
+ } finally {
585
+ hasRequestedReview = true;
586
+ }
587
+ }
588
+ const timeout = setTimeout(() => {
589
+ showRequestReview();
590
+ }, 1000);
591
+
592
+ return () => clearTimeout(timeout);
593
+ }, []);
594
+
595
+ return (
596
+ <View className="gap-3">
597
+ <Text className="pb-2 text-center font-semibold">Please follow the guidelines.</Text>
598
+ <View className="flex-row">
599
+ <Text className="w-6 text-center text-muted-foreground">·</Text>
600
+ <View className="flex-1">
601
+ <Text variant="caption1" className="text-muted-foreground">
602
+ Don't call StoreReview.requestReview() from a button
603
+ </Text>
604
+ </View>
605
+ </View>
606
+ <View className="flex-row">
607
+ <Text className="w-6 text-center text-muted-foreground">·</Text>
608
+ <View className="flex-1">
609
+ <Text variant="caption1" className="text-muted-foreground">
610
+ Don't request a review when the user is doing something time sensitive.
611
+ </Text>
612
+ </View>
613
+ </View>
614
+ <View className="flex-row">
615
+ <Text className="w-6 text-center text-muted-foreground">·</Text>
616
+ <View className="flex-1">
617
+ <Text variant="caption1" className="text-muted-foreground">
618
+ Don't ask the user any questions before or while presenting the rating button or
619
+ card.
620
+ </Text>
621
+ </View>
622
+ </View>
623
+ </View>
624
+ );
625
+ },
626
+ },
627
+ <% } %>
628
+ <% if (props.stylingPackage?.options.selectedComponents.includes('activity-view')) { %>
629
+ {
630
+ name: 'Activity View',
631
+ component: function ActivityViewExample() {
632
+ return (
633
+ <View className='items-center'>
634
+ <DefaultButton
635
+ onPress={async () => {
636
+ try {
637
+ const result = await Share.share({
638
+ message: 'NativeWindUI | Familiar interface, native feel.',
639
+ });
640
+ if (result.action === Share.sharedAction) {
641
+ if (result.activityType) {
642
+ // shared with activity type of result.activityType
643
+ } else {
644
+ // shared
645
+ }
646
+ } else if (result.action === Share.dismissedAction) {
647
+ // dismissed
648
+ }
649
+ } catch (error: any) {
650
+ Alert.alert(error.message);
651
+ }
652
+ }}
653
+ title='Share a message'
654
+ />
655
+ </View>
656
+ );
657
+ },
658
+ },
659
+ <% } %>
660
+ <% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
661
+ {
662
+ name: 'Bottom Sheet',
663
+ component: function BottomSheetExample() {
664
+ const { colorScheme } = useColorScheme();
665
+ const bottomSheetModalRef = useSheetRef();
97
666
 
98
- const COMPONENTS: ComponentItem[] = [];
667
+ return (
668
+ <View className='items-center'>
669
+ <DefaultButton
670
+ color={
671
+ colorScheme === 'dark' && Platform.OS === 'ios'
672
+ ? 'white'
673
+ : 'black'
674
+ }
675
+ title='Open Bottom Sheet'
676
+ onPress={() => bottomSheetModalRef.current?.present()}
677
+ />
678
+ <Sheet ref={bottomSheetModalRef} snapPoints={[200]}>
679
+ <View className='flex-1 justify-center items-center pb-8'>
680
+ <Text>@gorhom/bottom-sheet 🎉</Text>
681
+ </View>
682
+ </Sheet>
683
+ </View>
684
+ );
685
+ },
686
+ },
687
+ <% } %>
688
+ <% if (props.stylingPackage?.options.selectedComponents.includes('avatar')) { %>
689
+ {
690
+ name: 'Avatar',
691
+ component: function AvatarExample() {
692
+ const GITHUB_AVATAR_URI = 'https://github.com/mrzachnugent.png';
693
+ return (
694
+ <View className='items-center'>
695
+ <Avatar alt="Zach Nugent's Avatar">
696
+ <AvatarImage source={{ uri: GITHUB_AVATAR_URI }} />
697
+ <AvatarFallback>
698
+ <Text>ZN</Text>
699
+ </AvatarFallback>
700
+ </Avatar>
701
+ </View>
702
+ );
703
+ },
704
+ },
705
+ <% } %>
706
+ ];
99
707