@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.
- package/README.md +435 -0
- package/bin/create-expo-stack.js +2 -0
- package/build/cli.js +49 -0
- package/build/commands/create-expo-stack.js +471 -0
- package/build/constants.js +39 -0
- package/build/templates/base/.gitignore.ejs +26 -0
- package/build/templates/base/.npmrc.ejs +1 -0
- package/build/templates/base/App.tsx.ejs +66 -0
- package/build/templates/base/app.json.ejs +69 -0
- package/build/templates/base/assets/adaptive-icon.png +0 -0
- package/build/templates/base/assets/favicon.png +0 -0
- package/build/templates/base/assets/icon.png +0 -0
- package/build/templates/base/assets/splash.png +0 -0
- package/build/templates/base/babel.config.js.ejs +38 -0
- package/build/templates/base/components/BackButton.tsx.ejs +23 -0
- package/build/templates/base/components/Button.tsx.ejs +42 -0
- package/build/templates/base/components/Container.tsx.ejs +14 -0
- package/build/templates/base/components/EditScreenInfo.tsx.ejs +44 -0
- package/build/templates/base/components/HeaderButton.tsx.ejs +31 -0
- package/build/templates/base/components/ScreenContent.tsx.ejs +40 -0
- package/build/templates/base/components/TabBarIcon.tsx.ejs +15 -0
- package/build/templates/base/eslint.config.js.ejs +15 -0
- package/build/templates/base/package.json.ejs +191 -0
- package/build/templates/base/prettier.config.js.ejs +11 -0
- package/build/templates/base/tsconfig.json.ejs +39 -0
- package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/_layout.tsx.ejs +40 -0
- package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/index.tsx.ejs +15 -0
- package/build/templates/packages/expo-router/drawer/app/(drawer)/(tabs)/two.tsx.ejs +15 -0
- package/build/templates/packages/expo-router/drawer/app/(drawer)/_layout.tsx.ejs +65 -0
- package/build/templates/packages/expo-router/drawer/app/(drawer)/index.tsx.ejs +15 -0
- package/build/templates/packages/expo-router/drawer/app/+html.tsx.ejs +49 -0
- package/build/templates/packages/expo-router/drawer/app/+not-found.tsx.ejs +100 -0
- package/build/templates/packages/expo-router/drawer/app/_layout.tsx.ejs +91 -0
- package/build/templates/packages/expo-router/drawer/app/modal.tsx.ejs +21 -0
- package/build/templates/packages/expo-router/expo-env.d.ts +4 -0
- package/build/templates/packages/expo-router/index.js.ejs +4 -0
- package/build/templates/packages/expo-router/metro.config.js.ejs +24 -0
- package/build/templates/packages/expo-router/stack/app/+html.tsx.ejs +49 -0
- package/build/templates/packages/expo-router/stack/app/+not-found.tsx.ejs +113 -0
- package/build/templates/packages/expo-router/stack/app/_layout.tsx.ejs +63 -0
- package/build/templates/packages/expo-router/stack/app/details.tsx.ejs +56 -0
- package/build/templates/packages/expo-router/stack/app/index.tsx.ejs +73 -0
- package/build/templates/packages/expo-router/tabs/app/(tabs)/_layout.tsx.ejs +52 -0
- package/build/templates/packages/expo-router/tabs/app/(tabs)/index.tsx.ejs +37 -0
- package/build/templates/packages/expo-router/tabs/app/(tabs)/two.tsx.ejs +37 -0
- package/build/templates/packages/expo-router/tabs/app/+html.tsx.ejs +49 -0
- package/build/templates/packages/expo-router/tabs/app/+not-found.tsx.ejs +110 -0
- package/build/templates/packages/expo-router/tabs/app/_layout.tsx.ejs +84 -0
- package/build/templates/packages/expo-router/tabs/app/modal.tsx.ejs +21 -0
- package/build/templates/packages/firebase/.env.ejs +8 -0
- package/build/templates/packages/firebase/metro.config.js.ejs +14 -0
- package/build/templates/packages/firebase/utils/firebase.ts.ejs +26 -0
- package/build/templates/packages/i18next/components/InternalizationExample.tsx.ejs +23 -0
- package/build/templates/packages/i18next/core/i18n/fallbackChecker.ts.ejs +13 -0
- package/build/templates/packages/i18next/core/i18n/init.ts.ejs +24 -0
- package/build/templates/packages/i18next/core/i18n/languageDetector.ts.ejs +13 -0
- package/build/templates/packages/i18next/translation/en.json.ejs +8 -0
- package/build/templates/packages/i18next/translation/fr.json.ejs +8 -0
- package/build/templates/packages/i18next/translation/index.ts.ejs +20 -0
- package/build/templates/packages/nativewind/components/BackButton.tsx.ejs +22 -0
- package/build/templates/packages/nativewind/components/Button.tsx.ejs +21 -0
- package/build/templates/packages/nativewind/components/Container.tsx.ejs +13 -0
- package/build/templates/packages/nativewind/components/EditScreenInfo.tsx.ejs +40 -0
- package/build/templates/packages/nativewind/components/ScreenContent.tsx.ejs +27 -0
- package/build/templates/packages/nativewind/global.css +3 -0
- package/build/templates/packages/nativewind/metro.config.js +7 -0
- package/build/templates/packages/nativewind/nativewind-env.d.ts +2 -0
- package/build/templates/packages/nativewind/tailwind.config.js.ejs +15 -0
- package/build/templates/packages/nativewindui/components/Container.tsx.ejs +14 -0
- package/build/templates/packages/nativewindui/components/EditScreenInfo.tsx.ejs +45 -0
- package/build/templates/packages/nativewindui/components/HeaderButton.tsx.ejs +31 -0
- package/build/templates/packages/nativewindui/components/ScreenContent.tsx.ejs +40 -0
- package/build/templates/packages/nativewindui/components/TabBarIcon.tsx.ejs +15 -0
- package/build/templates/packages/nativewindui/components/nativewindui/Icon/Icon.ios.tsx.ejs +52 -0
- package/build/templates/packages/nativewindui/components/nativewindui/Icon/Icon.tsx.ejs +58 -0
- package/build/templates/packages/nativewindui/components/nativewindui/Icon/index.ts.ejs +16 -0
- package/build/templates/packages/nativewindui/components/nativewindui/Icon/types.ts.ejs +18 -0
- package/build/templates/packages/nativewindui/components/nativewindui/ThemeToggle.tsx.ejs +33 -0
- package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/_layout.tsx.ejs +28 -0
- package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/index.tsx.ejs +15 -0
- package/build/templates/packages/nativewindui/drawer/app/(drawer)/(tabs)/two.tsx.ejs +15 -0
- package/build/templates/packages/nativewindui/drawer/app/(drawer)/_layout.tsx.ejs +35 -0
- package/build/templates/packages/nativewindui/drawer/app/(drawer)/index.tsx.ejs +535 -0
- package/build/templates/packages/nativewindui/drawer/app/+html.tsx.ejs +46 -0
- package/build/templates/packages/nativewindui/drawer/app/+not-found.tsx.ejs +83 -0
- package/build/templates/packages/nativewindui/drawer/app/_layout.tsx.ejs +75 -0
- package/build/templates/packages/nativewindui/drawer/app/modal.tsx.ejs +33 -0
- package/build/templates/packages/nativewindui/global.css.ejs +91 -0
- package/build/templates/packages/nativewindui/lib/cn.ts.ejs +6 -0
- package/build/templates/packages/nativewindui/lib/useColorScheme.tsx.ejs +21 -0
- package/build/templates/packages/nativewindui/nativewind-env.d.ts.ejs +1 -0
- package/build/templates/packages/nativewindui/stack/app/+html.tsx.ejs +46 -0
- package/build/templates/packages/nativewindui/stack/app/+not-found.tsx.ejs +18 -0
- package/build/templates/packages/nativewindui/stack/app/_layout.tsx.ejs +78 -0
- package/build/templates/packages/nativewindui/stack/app/index.tsx.ejs +487 -0
- package/build/templates/packages/nativewindui/stack/app/modal.tsx.ejs +33 -0
- package/build/templates/packages/nativewindui/tabs/app/(tabs)/_layout.tsx.ejs +35 -0
- package/build/templates/packages/nativewindui/tabs/app/(tabs)/index.tsx.ejs +537 -0
- package/build/templates/packages/nativewindui/tabs/app/(tabs)/two.tsx.ejs +22 -0
- package/build/templates/packages/nativewindui/tabs/app/+html.tsx.ejs +46 -0
- package/build/templates/packages/nativewindui/tabs/app/+not-found.tsx.ejs +90 -0
- package/build/templates/packages/nativewindui/tabs/app/_layout.tsx.ejs +78 -0
- package/build/templates/packages/nativewindui/tabs/app/modal.tsx.ejs +21 -0
- package/build/templates/packages/nativewindui/tailwind.config.js.ejs +67 -0
- package/build/templates/packages/nativewindui/theme/colors.ts.ejs +123 -0
- package/build/templates/packages/nativewindui/theme/index.ts.ejs +32 -0
- package/build/templates/packages/nativewindui/theme/with-opacity.ts.ejs +155 -0
- package/build/templates/packages/react-navigation/App.tsx.ejs +73 -0
- package/build/templates/packages/react-navigation/navigation/drawer-navigator.tsx.ejs +31 -0
- package/build/templates/packages/react-navigation/navigation/index.tsx.ejs +108 -0
- package/build/templates/packages/react-navigation/navigation/tab-navigator.tsx.ejs +38 -0
- package/build/templates/packages/react-navigation/screens/details.tsx.ejs +41 -0
- package/build/templates/packages/react-navigation/screens/home.tsx.ejs +5 -0
- package/build/templates/packages/react-navigation/screens/modal.tsx.ejs +20 -0
- package/build/templates/packages/react-navigation/screens/one.tsx.ejs +5 -0
- package/build/templates/packages/react-navigation/screens/overview.tsx.ejs +54 -0
- package/build/templates/packages/react-navigation/screens/two.tsx.ejs +5 -0
- package/build/templates/packages/restyle/components/BackButton.tsx.ejs +19 -0
- package/build/templates/packages/restyle/components/Button.tsx.ejs +32 -0
- package/build/templates/packages/restyle/components/Container.tsx.ejs +16 -0
- package/build/templates/packages/restyle/components/EditScreenInfo.tsx.ejs +38 -0
- package/build/templates/packages/restyle/components/ScreenContent.tsx.ejs +30 -0
- package/build/templates/packages/restyle/theme.ts.ejs +51 -0
- package/build/templates/packages/supabase/.env.ejs +2 -0
- package/build/templates/packages/supabase/utils/supabase.ts.ejs +14 -0
- package/build/templates/packages/tamagui/components/BackButton.tsx.ejs +12 -0
- package/build/templates/packages/tamagui/components/Button.tsx.ejs +17 -0
- package/build/templates/packages/tamagui/components/Container.tsx.ejs +12 -0
- package/build/templates/packages/tamagui/components/EditScreenInfo.tsx.ejs +27 -0
- package/build/templates/packages/tamagui/components/ScreenContent.tsx.ejs +23 -0
- package/build/templates/packages/tamagui/tamagui.config.ts.ejs +14 -0
- package/build/templates/packages/unistyles/breakpoints.ts.ejs +9 -0
- package/build/templates/packages/unistyles/components/BackButton.tsx.ejs +28 -0
- package/build/templates/packages/unistyles/components/Button.tsx.ejs +42 -0
- package/build/templates/packages/unistyles/components/Container.tsx.ejs +17 -0
- package/build/templates/packages/unistyles/components/EditScreenInfo.tsx.ejs +53 -0
- package/build/templates/packages/unistyles/components/ScreenContent.tsx.ejs +43 -0
- package/build/templates/packages/unistyles/theme.ts.ejs +34 -0
- package/build/templates/packages/unistyles/unistyles.ts.ejs +27 -0
- package/build/templates/packages/uniwind/global.css +2 -0
- package/build/templates/packages/uniwind/metro.config.js.ejs +10 -0
- package/build/templates/packages/vexo-analytics/.env.ejs +7 -0
- package/build/templates/packages/zustand/store/store.ts.ejs +15 -0
- package/build/types/cli.d.ts +4 -0
- package/build/types/commands/create-expo-stack.d.ts +3 -0
- package/build/types/constants.d.ts +10 -0
- package/build/types/types.d.ts +33 -0
- package/build/types/utilities/bumpVersion.d.ts +1 -0
- package/build/types/utilities/clearNavigationPackages.d.ts +2 -0
- package/build/types/utilities/clearStylingPackages.d.ts +2 -0
- package/build/types/utilities/configAnalytics.d.ts +18 -0
- package/build/types/utilities/configStorage.d.ts +8 -0
- package/build/types/utilities/configureProjectFiles.d.ts +3 -0
- package/build/types/utilities/copyBaseAssets.d.ts +2 -0
- package/build/types/utilities/generateNWUI.d.ts +3 -0
- package/build/types/utilities/generateProjectFiles.d.ts +5 -0
- package/build/types/utilities/getPackageManager.d.ts +8 -0
- package/build/types/utilities/index.d.ts +10 -0
- package/build/types/utilities/printOutput.d.ts +3 -0
- package/build/types/utilities/publishToGitHub.d.ts +2 -0
- package/build/types/utilities/renderTitle.d.ts +2 -0
- package/build/types/utilities/runCLI.d.ts +3 -0
- package/build/types/utilities/runEasConfigure.d.ts +3 -0
- package/build/types/utilities/runIgnite.d.ts +3 -0
- package/build/types/utilities/showHelp.d.ts +1 -0
- package/build/types/utilities/systemCommand.d.ts +14 -0
- package/build/types/utilities/usePackage.d.ts +2 -0
- package/build/types/utilities/validateProjectName.d.ts +4 -0
- package/build/types.js +39 -0
- package/build/utilities/bumpVersion.js +21 -0
- package/build/utilities/clearNavigationPackages.js +11 -0
- package/build/utilities/clearStylingPackages.js +11 -0
- package/build/utilities/configAnalytics.js +70 -0
- package/build/utilities/configStorage.js +50 -0
- package/build/utilities/configureProjectFiles.js +380 -0
- package/build/utilities/copyBaseAssets.js +21 -0
- package/build/utilities/generateNWUI.js +54 -0
- package/build/utilities/generateProjectFiles.js +106 -0
- package/build/utilities/getPackageManager.js +103 -0
- package/build/utilities/index.js +27 -0
- package/build/utilities/printOutput.js +251 -0
- package/build/utilities/publishToGitHub.js +173 -0
- package/build/utilities/renderTitle.js +55 -0
- package/build/utilities/runCLI.js +437 -0
- package/build/utilities/runEasConfigure.js +83 -0
- package/build/utilities/runIgnite.js +26 -0
- package/build/utilities/showHelp.js +85 -0
- package/build/utilities/systemCommand.js +40 -0
- package/build/utilities/usePackage.js +8 -0
- package/build/utilities/validateProjectName.js +42 -0
- package/package.json +77 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
|
2
|
+
import { FlashList } from '@shopify/flash-list';
|
|
3
|
+
import { cssInterop } from 'nativewind';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import {
|
|
6
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('activity-view')) { %>
|
|
7
|
+
Alert,
|
|
8
|
+
<% } %>
|
|
9
|
+
<% if (
|
|
10
|
+
props.stylingPackage?.options.selectedComponents.includes('action-sheet') ||
|
|
11
|
+
props.stylingPackage?.options.selectedComponents.includes('activity-view')
|
|
12
|
+
) { %>
|
|
13
|
+
Button as RNButton,
|
|
14
|
+
ButtonProps,
|
|
15
|
+
<% } %>
|
|
16
|
+
Linking,
|
|
17
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('activity-view')) { %>
|
|
18
|
+
Share,
|
|
19
|
+
<% } %>
|
|
20
|
+
useWindowDimensions,
|
|
21
|
+
View,
|
|
22
|
+
} from 'react-native';
|
|
23
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
24
|
+
import { SearchBarProps } from 'react-native-screens';
|
|
25
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
|
|
26
|
+
import { useActionSheet } from '@expo/react-native-action-sheet';
|
|
27
|
+
<% } %>
|
|
28
|
+
import { useNavigation } from '@react-navigation/native';
|
|
29
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('button')) { %>
|
|
30
|
+
import * as Haptics from 'expo-haptics';
|
|
31
|
+
<% } else { %>
|
|
32
|
+
// import * as Haptics from 'expo-haptics';
|
|
33
|
+
<% } %>
|
|
34
|
+
|
|
35
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('activity-indicator')) { %>
|
|
36
|
+
import { ActivityIndicator } from '@/components/nativewindui/ActivityIndicator';
|
|
37
|
+
<% } %>
|
|
38
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('avatar')) { %>
|
|
39
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/nativewindui/Avatar';
|
|
40
|
+
<% } %>
|
|
41
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('button')) { %>
|
|
42
|
+
import { Button } from '@/components/nativewindui/Button';
|
|
43
|
+
<% } else { %>
|
|
44
|
+
// import { Button } from '@/components/nativewindui/Button';
|
|
45
|
+
<% } %>
|
|
46
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('date-picker')) { %>
|
|
47
|
+
import { DatePicker } from '@/components/nativewindui/DatePicker';
|
|
48
|
+
<% } %>
|
|
49
|
+
import { Icon } from '@/components/nativewindui/Icon';
|
|
50
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('picker')) { %>
|
|
51
|
+
import { Picker, PickerItem } from '@/components/nativewindui/Picker';
|
|
52
|
+
<% } %>
|
|
53
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('progress-indicator')) { %>
|
|
54
|
+
import { ProgressIndicator } from '@/components/nativewindui/ProgressIndicator';
|
|
55
|
+
<% } %>
|
|
56
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('slider')) { %>
|
|
57
|
+
import { Slider } from '@/components/nativewindui/Slider';
|
|
58
|
+
<% } %>
|
|
59
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('text')) { %>
|
|
60
|
+
import { Text } from '@/components/nativewindui/Text';
|
|
61
|
+
<% } else { %>
|
|
62
|
+
// import { Text } from '@/components/nativewindui/Text';
|
|
63
|
+
<% } %>
|
|
64
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('toggle')) { %>
|
|
65
|
+
import { Toggle } from '@/components/nativewindui/Toggle';
|
|
66
|
+
<% } %>
|
|
67
|
+
import { useColorScheme } from '@/lib/useColorScheme';
|
|
68
|
+
import { COLORS } from '@/theme/colors';
|
|
69
|
+
|
|
70
|
+
cssInterop(FlashList, {
|
|
71
|
+
className: 'style',
|
|
72
|
+
contentContainerClassName: 'contentContainerStyle',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export default function Screen() {
|
|
76
|
+
const searchValue = useHeaderSearchBar({ hideWhenScrolling: COMPONENTS.length === 0 });
|
|
77
|
+
|
|
78
|
+
const data = searchValue
|
|
79
|
+
? COMPONENTS.filter((c) => c.name.toLowerCase().includes(searchValue.toLowerCase()))
|
|
80
|
+
: COMPONENTS;
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<FlashList
|
|
84
|
+
contentInsetAdjustmentBehavior="automatic"
|
|
85
|
+
keyboardShouldPersistTaps="handled"
|
|
86
|
+
data={data}
|
|
87
|
+
contentContainerClassName="py-4 android:pb-12"
|
|
88
|
+
extraData={searchValue}
|
|
89
|
+
removeClippedSubviews={false} // used for slecting text on android
|
|
90
|
+
keyExtractor={keyExtractor}
|
|
91
|
+
ItemSeparatorComponent={renderItemSeparator}
|
|
92
|
+
renderItem={renderItem}
|
|
93
|
+
ListEmptyComponent={COMPONENTS.length === 0 ? ListEmptyComponent : undefined}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function useHeaderSearchBar(props: SearchBarProps = {}) {
|
|
99
|
+
const { colorScheme, colors } = useColorScheme();
|
|
100
|
+
const navigation = useNavigation();
|
|
101
|
+
const [search, setSearch] = React.useState('');
|
|
102
|
+
|
|
103
|
+
React.useLayoutEffect(() => {
|
|
104
|
+
navigation.setOptions({
|
|
105
|
+
headerSearchBarOptions: {
|
|
106
|
+
placeholder: 'Search...',
|
|
107
|
+
textColor: colors.foreground,
|
|
108
|
+
tintColor: colors.primary,
|
|
109
|
+
headerIconColor: colors.foreground,
|
|
110
|
+
hintTextColor: colors.grey,
|
|
111
|
+
hideWhenScrolling: false,
|
|
112
|
+
onChangeText(ev) {
|
|
113
|
+
setSearch(ev.nativeEvent.text);
|
|
114
|
+
},
|
|
115
|
+
...props,
|
|
116
|
+
} satisfies SearchBarProps,
|
|
117
|
+
});
|
|
118
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
119
|
+
}, [navigation, colorScheme]);
|
|
120
|
+
|
|
121
|
+
return search;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function ListEmptyComponent() {
|
|
125
|
+
const insets = useSafeAreaInsets();
|
|
126
|
+
const dimensions = useWindowDimensions();
|
|
127
|
+
const headerHeight = useHeaderHeight();
|
|
128
|
+
const { colors } = useColorScheme();
|
|
129
|
+
const height = dimensions.height - headerHeight - insets.bottom - insets.top;
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<View style={{ height }} className="flex-1 items-center justify-center gap-1 px-12">
|
|
133
|
+
<Icon name="doc.badge.plus" size={42} color={colors.grey} />
|
|
134
|
+
<Text variant='title3' className='pb-1 text-center font-semibold'>
|
|
135
|
+
No Components Installed
|
|
136
|
+
</Text>
|
|
137
|
+
<Text color='tertiary' variant='subhead' className='pb-4 text-center'>
|
|
138
|
+
You can install any of the free components from the{' '}
|
|
139
|
+
<Text
|
|
140
|
+
onPress={() => Linking.openURL('https://nativewindui.com')}
|
|
141
|
+
variant='subhead'
|
|
142
|
+
className='text-primary'
|
|
143
|
+
>
|
|
144
|
+
NativewindUI
|
|
145
|
+
</Text>
|
|
146
|
+
{' website.'}
|
|
147
|
+
</Text>
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
type ComponentItem = { name: string; component: React.FC };
|
|
153
|
+
|
|
154
|
+
function keyExtractor(item: ComponentItem) {
|
|
155
|
+
return item.name;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function renderItemSeparator() {
|
|
159
|
+
return <View className="p-2" />;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function renderItem({ item }: { item: ComponentItem }) {
|
|
163
|
+
return (
|
|
164
|
+
<Card title={item.name}>
|
|
165
|
+
<item.component />
|
|
166
|
+
</Card>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function Card({ children, title }: { children: React.ReactNode; title: string }) {
|
|
171
|
+
return (
|
|
172
|
+
<View className="px-4">
|
|
173
|
+
<View className="gap-4 rounded-xl border border-border bg-card p-4 pb-6 shadow-sm shadow-black/10 dark:shadow-none">
|
|
174
|
+
<Text className="text-center text-sm font-medium tracking-wider opacity-60">{title}</Text>
|
|
175
|
+
{children}
|
|
176
|
+
</View>
|
|
177
|
+
</View>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const COMPONENTS: ComponentItem[] = [
|
|
182
|
+
<% if (!props.stylingPackage?.options.selectedComponents.length) { %>
|
|
183
|
+
// ADD ANY ADDITIONAL COMPONENTS HERE
|
|
184
|
+
// {
|
|
185
|
+
// name: 'Component Name',
|
|
186
|
+
// component: function ComponentNameExample() {
|
|
187
|
+
// return (
|
|
188
|
+
// <View>
|
|
189
|
+
// <Text>Component Example</Text>
|
|
190
|
+
// </View>
|
|
191
|
+
// );
|
|
192
|
+
// },
|
|
193
|
+
// },
|
|
194
|
+
<% } %>
|
|
195
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('avatar')) { %>
|
|
196
|
+
{
|
|
197
|
+
name: 'Avatar',
|
|
198
|
+
component: function AvatarExample() {
|
|
199
|
+
const TWITTER_AVATAR_URI = 'https://pbs.twimg.com/profile_images/1782428433898708992/1voyv4_A_400x400.jpg';
|
|
200
|
+
return (
|
|
201
|
+
<View className='items-center'>
|
|
202
|
+
<Avatar alt="NativewindUI Avatar">
|
|
203
|
+
<AvatarImage source={{ uri: TWITTER_AVATAR_URI }} />
|
|
204
|
+
<AvatarFallback>
|
|
205
|
+
<Text>NWUI</Text>
|
|
206
|
+
</AvatarFallback>
|
|
207
|
+
</Avatar>
|
|
208
|
+
</View>
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
<% } %>
|
|
213
|
+
// {
|
|
214
|
+
// name: 'Button',
|
|
215
|
+
// component: function ButtonExample() {
|
|
216
|
+
// function onPress() {
|
|
217
|
+
// Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
218
|
+
// }
|
|
219
|
+
// return (
|
|
220
|
+
// <View className="items-center justify-center gap-4 p-4">
|
|
221
|
+
// <Button onPress={onPress}>
|
|
222
|
+
// <Icon name="play.fill" className="ios:size-4 text-white" />
|
|
223
|
+
// <Text>Primary</Text>
|
|
224
|
+
// </Button>
|
|
225
|
+
// <Button onPress={onPress} variant="secondary">
|
|
226
|
+
// <Text>Secondary</Text>
|
|
227
|
+
// </Button>
|
|
228
|
+
// <Button onPress={onPress} variant="tonal">
|
|
229
|
+
// <Text>Tonal</Text>
|
|
230
|
+
// </Button>
|
|
231
|
+
// <Button onPress={onPress} variant="plain">
|
|
232
|
+
// <Text>Plain</Text>
|
|
233
|
+
// </Button>
|
|
234
|
+
// <Button onPress={onPress} variant="tonal" size="icon">
|
|
235
|
+
// <Icon name="heart.fill" className="ios:text-primary size-5 text-foreground" />
|
|
236
|
+
// </Button>
|
|
237
|
+
// </View>
|
|
238
|
+
// );
|
|
239
|
+
// },
|
|
240
|
+
// },
|
|
241
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('slider')) { %>
|
|
242
|
+
{
|
|
243
|
+
name: 'Slider',
|
|
244
|
+
component: function SliderExample() {
|
|
245
|
+
const [sliderValue, setSliderValue] = React.useState(0.5);
|
|
246
|
+
return <Slider value={sliderValue} onValueChange={setSliderValue} minimumValue={0} maximumValue={1} />;
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
<% } %>
|
|
250
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('activity-indicator')) { %>
|
|
251
|
+
{
|
|
252
|
+
name: 'Activity Indicator',
|
|
253
|
+
component: function ActivityIndicatorExample() {
|
|
254
|
+
return (
|
|
255
|
+
<View className='items-center p-4'>
|
|
256
|
+
<ActivityIndicator />
|
|
257
|
+
</View>
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
<% } %>
|
|
262
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
|
|
263
|
+
{
|
|
264
|
+
name: 'Action Sheet',
|
|
265
|
+
component: function ActionSheetExample() {
|
|
266
|
+
const { colorScheme, colors } = useColorScheme();
|
|
267
|
+
const { showActionSheetWithOptions } = useActionSheet();
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<View className='items-center'>
|
|
271
|
+
<Button
|
|
272
|
+
variant='secondary'
|
|
273
|
+
onPress={async () => {
|
|
274
|
+
const options = ['Delete', 'Save', 'Cancel'];
|
|
275
|
+
const destructiveButtonIndex = 0;
|
|
276
|
+
const cancelButtonIndex = 2;
|
|
277
|
+
|
|
278
|
+
showActionSheetWithOptions(
|
|
279
|
+
{
|
|
280
|
+
options,
|
|
281
|
+
cancelButtonIndex,
|
|
282
|
+
destructiveButtonIndex,
|
|
283
|
+
containerStyle: {
|
|
284
|
+
backgroundColor: colorScheme === 'dark' ? 'black' : 'white',
|
|
285
|
+
},
|
|
286
|
+
textStyle: {
|
|
287
|
+
color: colors.foreground,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
(selectedIndex) => {
|
|
291
|
+
switch (selectedIndex) {
|
|
292
|
+
case 1:
|
|
293
|
+
// Save
|
|
294
|
+
break;
|
|
295
|
+
|
|
296
|
+
case destructiveButtonIndex:
|
|
297
|
+
// Delete
|
|
298
|
+
break;
|
|
299
|
+
|
|
300
|
+
case cancelButtonIndex:
|
|
301
|
+
// Canceled
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}}>
|
|
306
|
+
<Text>Open action sheet</Text>
|
|
307
|
+
</Button>
|
|
308
|
+
</View>
|
|
309
|
+
);
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
<% } %>
|
|
313
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('progress-indicator')) { %>
|
|
314
|
+
{
|
|
315
|
+
name: 'Progress Indicator',
|
|
316
|
+
component: function ProgressIndicatorExample() {
|
|
317
|
+
const [progress, setProgress] = React.useState(13);
|
|
318
|
+
|
|
319
|
+
React.useEffect(() => {
|
|
320
|
+
let id: ReturnType<typeof setInterval> | null = null;
|
|
321
|
+
if (!id) {
|
|
322
|
+
id = setInterval(() => {
|
|
323
|
+
setProgress((prev) => (prev >= 99 ? 0 : prev + 5));
|
|
324
|
+
}, 1000);
|
|
325
|
+
}
|
|
326
|
+
return () => {
|
|
327
|
+
if (id) clearInterval(id);
|
|
328
|
+
};
|
|
329
|
+
}, []);
|
|
330
|
+
return (
|
|
331
|
+
<View className='p-4'>
|
|
332
|
+
<ProgressIndicator value={progress} />
|
|
333
|
+
</View>
|
|
334
|
+
);
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
<% } %>
|
|
338
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('activity-view')) { %>
|
|
339
|
+
{
|
|
340
|
+
name: 'Activity View',
|
|
341
|
+
component: function ActivityViewExample() {
|
|
342
|
+
return (
|
|
343
|
+
<View className='items-center'>
|
|
344
|
+
<Button
|
|
345
|
+
variant='tonal'
|
|
346
|
+
onPress={async () => {
|
|
347
|
+
try {
|
|
348
|
+
const result = await Share.share({
|
|
349
|
+
message: 'NativewindUI | Native feeling UI with TailwindCSS.',
|
|
350
|
+
});
|
|
351
|
+
if (result.action === Share.sharedAction) {
|
|
352
|
+
if (result.activityType) {
|
|
353
|
+
// shared with activity type of result.activityType
|
|
354
|
+
} else {
|
|
355
|
+
// shared
|
|
356
|
+
}
|
|
357
|
+
} else if (result.action === Share.dismissedAction) {
|
|
358
|
+
// dismissed
|
|
359
|
+
}
|
|
360
|
+
} catch (error: any) {
|
|
361
|
+
Alert.alert(error.message);
|
|
362
|
+
}
|
|
363
|
+
}}>
|
|
364
|
+
<Text>Share a message</Text>
|
|
365
|
+
</Button>
|
|
366
|
+
</View>
|
|
367
|
+
);
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
<% } %>
|
|
371
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('date-picker')) { %>
|
|
372
|
+
{
|
|
373
|
+
name: 'Date Picker',
|
|
374
|
+
component: function DatePickerExample() {
|
|
375
|
+
const [date, setDate] = React.useState(new Date());
|
|
376
|
+
return (
|
|
377
|
+
<View className='items-center'>
|
|
378
|
+
<DatePicker
|
|
379
|
+
value={date}
|
|
380
|
+
mode='datetime'
|
|
381
|
+
onChange={(ev) => {
|
|
382
|
+
setDate(new Date(ev.nativeEvent.timestamp));
|
|
383
|
+
}}
|
|
384
|
+
/>
|
|
385
|
+
</View>
|
|
386
|
+
);
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
<% } %>
|
|
390
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('picker')) { %>
|
|
391
|
+
{
|
|
392
|
+
name: 'Picker',
|
|
393
|
+
component: function PickerExample() {
|
|
394
|
+
const { colors } = useColorScheme();
|
|
395
|
+
const [picker, setPicker] = React.useState('blue');
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<Picker
|
|
399
|
+
selectedValue={picker}
|
|
400
|
+
onValueChange={(itemValue) => setPicker(itemValue)}
|
|
401
|
+
>
|
|
402
|
+
<PickerItem
|
|
403
|
+
label='Red'
|
|
404
|
+
value='red'
|
|
405
|
+
color={colors.foreground}
|
|
406
|
+
style={{
|
|
407
|
+
backgroundColor: colors.root,
|
|
408
|
+
}}
|
|
409
|
+
/>
|
|
410
|
+
<PickerItem
|
|
411
|
+
label='Blue'
|
|
412
|
+
value='blue'
|
|
413
|
+
color={colors.foreground}
|
|
414
|
+
style={{
|
|
415
|
+
backgroundColor: colors.root,
|
|
416
|
+
}}
|
|
417
|
+
/>
|
|
418
|
+
<PickerItem
|
|
419
|
+
label='Green'
|
|
420
|
+
value='green'
|
|
421
|
+
color={colors.foreground}
|
|
422
|
+
style={{
|
|
423
|
+
backgroundColor: colors.root,
|
|
424
|
+
}}
|
|
425
|
+
/>
|
|
426
|
+
</Picker>
|
|
427
|
+
);
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
<% } %>
|
|
431
|
+
// {
|
|
432
|
+
// name: 'Text',
|
|
433
|
+
// component: function TextExample() {
|
|
434
|
+
// return (
|
|
435
|
+
// <View className="gap-2">
|
|
436
|
+
// <Text variant="largeTitle" className="text-center">
|
|
437
|
+
// Large Title
|
|
438
|
+
// </Text>
|
|
439
|
+
// <Text variant="title1" className="text-center">
|
|
440
|
+
// Title 1
|
|
441
|
+
// </Text>
|
|
442
|
+
// <Text variant="title2" className="text-center">
|
|
443
|
+
// Title 2
|
|
444
|
+
// </Text>
|
|
445
|
+
// <Text variant="title3" className="text-center">
|
|
446
|
+
// Title 3
|
|
447
|
+
// </Text>
|
|
448
|
+
// <Text variant="heading" className="text-center">
|
|
449
|
+
// Heading
|
|
450
|
+
// </Text>
|
|
451
|
+
// <Text variant="body" className="text-center">
|
|
452
|
+
// Body
|
|
453
|
+
// </Text>
|
|
454
|
+
// <Text variant="callout" className="text-center">
|
|
455
|
+
// Callout
|
|
456
|
+
// </Text>
|
|
457
|
+
// <Text variant="subhead" className="text-center">
|
|
458
|
+
// Subhead
|
|
459
|
+
// </Text>
|
|
460
|
+
// <Text variant="footnote" className="text-center">
|
|
461
|
+
// Footnote
|
|
462
|
+
// </Text>
|
|
463
|
+
// <Text variant="caption1" className="text-center">
|
|
464
|
+
// Caption 1
|
|
465
|
+
// </Text>
|
|
466
|
+
// <Text variant="caption2" className="text-center">
|
|
467
|
+
// Caption 2
|
|
468
|
+
// </Text>
|
|
469
|
+
// </View>
|
|
470
|
+
// );
|
|
471
|
+
// },
|
|
472
|
+
// },
|
|
473
|
+
<% if (props.stylingPackage?.options.selectedComponents.includes('toggle')) { %>
|
|
474
|
+
{
|
|
475
|
+
name: 'Toggle',
|
|
476
|
+
component: function ToggleExample() {
|
|
477
|
+
const [switchValue, setSwitchValue] = React.useState(true);
|
|
478
|
+
return (
|
|
479
|
+
<View className='items-center'>
|
|
480
|
+
<Toggle value={switchValue} onValueChange={setSwitchValue} className='mx-auto' />
|
|
481
|
+
</View>
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
<% } %>
|
|
486
|
+
];
|
|
487
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StatusBar } from 'expo-status-bar';
|
|
2
|
+
import { Linking, Platform, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Icon } from '@/components/nativewindui/Icon';
|
|
5
|
+
import { Text } from '@/components/nativewindui/Text';
|
|
6
|
+
import { useColorScheme } from '@/lib/useColorScheme';
|
|
7
|
+
|
|
8
|
+
export default function ModalScreen() {
|
|
9
|
+
const { colors, colorScheme } = useColorScheme();
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<StatusBar
|
|
13
|
+
style={Platform.OS === 'ios' ? 'light' : colorScheme === 'dark' ? 'light' : 'dark'}
|
|
14
|
+
/>
|
|
15
|
+
<View className="pb-safe items-center justify-center gap-1 px-12 flex-1">
|
|
16
|
+
<Icon name="doc.badge.plus" size={42} color={colors.grey} />
|
|
17
|
+
<Text variant="title3" className="pb-1 text-center font-semibold">
|
|
18
|
+
NativewindUI
|
|
19
|
+
</Text>
|
|
20
|
+
<Text color="tertiary" variant="subhead" className="pb-4 text-center">
|
|
21
|
+
You can install any of the free components from the{' '}
|
|
22
|
+
<Text
|
|
23
|
+
onPress={() => Linking.openURL('https://nativewindui.com')}
|
|
24
|
+
variant="subhead"
|
|
25
|
+
className="text-primary">
|
|
26
|
+
NativewindUI
|
|
27
|
+
</Text>
|
|
28
|
+
{' website.'}
|
|
29
|
+
</Text>
|
|
30
|
+
</View>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Link, Tabs } from "expo-router";
|
|
2
|
+
import { HeaderButton } from '../../components/HeaderButton';
|
|
3
|
+
import { TabBarIcon } from '../../components/TabBarIcon';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default function TabLayout() {
|
|
8
|
+
return (
|
|
9
|
+
<Tabs
|
|
10
|
+
screenOptions={{
|
|
11
|
+
tabBarActiveTintColor: 'black',
|
|
12
|
+
}}>
|
|
13
|
+
<Tabs.Screen
|
|
14
|
+
name='index'
|
|
15
|
+
options={{
|
|
16
|
+
title: 'Tab One',
|
|
17
|
+
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
|
|
18
|
+
headerRight: () => (
|
|
19
|
+
<Link href='/modal' asChild>
|
|
20
|
+
<HeaderButton />
|
|
21
|
+
</Link>
|
|
22
|
+
),
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
<Tabs.Screen
|
|
26
|
+
name="two"
|
|
27
|
+
options={{
|
|
28
|
+
title: 'Tab Two',
|
|
29
|
+
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
</Tabs>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|