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