create-expo-stack 2.7.0-next.0c1b767 → 2.7.0-next.3765374
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useHeaderHeight } from '@react-navigation/elements';
|
|
2
1
|
import { FlashList } from '@shopify/flash-list';
|
|
3
2
|
import { cssInterop } from 'nativewind';
|
|
4
3
|
import * as React from 'react';
|
|
5
|
-
import { Button as RNButton, ButtonProps, Linking, View
|
|
4
|
+
import { Button as RNButton, ButtonProps, Linking, View } from 'react-native';
|
|
6
5
|
|
|
7
6
|
import { Text } from '~/components/nativewind-ui/Text';
|
|
8
7
|
import { useColorScheme } from '~/lib/useColorScheme';
|
|
@@ -25,6 +24,26 @@ export default function Screen() {
|
|
|
25
24
|
? COMPONENTS.filter((c) => c.name.toLowerCase().includes(searchValue.toLowerCase()))
|
|
26
25
|
: COMPONENTS;
|
|
27
26
|
|
|
27
|
+
if (data.length === 0) {
|
|
28
|
+
return (
|
|
29
|
+
<View className='flex-1 justify-center items-center px-4'>
|
|
30
|
+
<Text variant='title3' className='text-center font-bold pb-1'>
|
|
31
|
+
{searchValue.length === 0
|
|
32
|
+
? 'No Components Installed'
|
|
33
|
+
: 'No Components Found'}
|
|
34
|
+
</Text>
|
|
35
|
+
<Text color='tertiary' variant='body' className='text-center pb-4'>
|
|
36
|
+
You can install any of the free components from the NativeWindUI
|
|
37
|
+
website.
|
|
38
|
+
</Text>
|
|
39
|
+
<DefaultButton
|
|
40
|
+
title='Open NativeWindUI'
|
|
41
|
+
onPress={() => Linking.openURL('https://nativewindui.com')}
|
|
42
|
+
/>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
28
47
|
return (
|
|
29
48
|
<FlashList
|
|
30
49
|
contentInsetAdjustmentBehavior="automatic"
|
|
@@ -32,40 +51,15 @@ export default function Screen() {
|
|
|
32
51
|
data={data}
|
|
33
52
|
estimatedItemSize={200}
|
|
34
53
|
contentContainerClassName="py-4"
|
|
35
|
-
centerContent={data.length === 0}
|
|
36
54
|
extraData={searchValue}
|
|
37
55
|
removeClippedSubviews={false} // used for selecting text on android
|
|
38
56
|
keyExtractor={keyExtractor}
|
|
39
57
|
ItemSeparatorComponent={renderItemSeparator}
|
|
40
58
|
renderItem={renderItem}
|
|
41
|
-
ListEmptyComponent={ListEmptyComponent}
|
|
42
59
|
/>
|
|
43
60
|
);
|
|
44
61
|
}
|
|
45
62
|
|
|
46
|
-
const SEARCH_BAR_HEIGHT = 52;
|
|
47
|
-
|
|
48
|
-
function ListEmptyComponent() {
|
|
49
|
-
const headerHeight = useHeaderHeight();
|
|
50
|
-
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
|
|
56
|
-
</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.
|
|
59
|
-
</Text>
|
|
60
|
-
<DefaultButton
|
|
61
|
-
title="Open NativeWindUI"
|
|
62
|
-
onPress={() => Linking.openURL('https://nativewindui.com')}
|
|
63
|
-
/>
|
|
64
|
-
</View>
|
|
65
|
-
</>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
63
|
type ComponentItem = { name: string; component: () => React.JSX.Element };
|
|
70
64
|
|
|
71
65
|
function keyExtractor(item: ComponentItem) {
|
|
@@ -73,7 +67,7 @@ function keyExtractor(item: ComponentItem) {
|
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
function renderItemSeparator() {
|
|
76
|
-
return <View className=
|
|
70
|
+
return <View className='p-2' />;
|
|
77
71
|
}
|
|
78
72
|
|
|
79
73
|
function renderItem({ item }: { item: ComponentItem }) {
|
|
@@ -87,7 +81,7 @@ function renderItem({ item }: { item: ComponentItem }) {
|
|
|
87
81
|
function Card({ children, title }: { children: React.ReactNode; title: string }) {
|
|
88
82
|
return (
|
|
89
83
|
<View className="px-4">
|
|
90
|
-
<View className="gap-4 rounded-xl border
|
|
84
|
+
<View className="bg-card border-border gap-4 rounded-xl border p-4 pb-6 shadow-sm shadow-black/10 dark:shadow-none">
|
|
91
85
|
<Text className="text-center text-sm font-medium tracking-wider opacity-60">{title}</Text>
|
|
92
86
|
{children}
|
|
93
87
|
</View>
|