create-expo-stack 2.20.0-next.7f9c8bc → 2.20.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 +1 -3
- package/build/cli.js +3 -2
- package/build/commands/create-expo-stack.js +9 -30
- package/build/constants.js +4 -4
- package/build/templates/base/App.tsx.ejs +12 -51
- package/build/templates/base/app.json.ejs +1 -0
- package/build/templates/base/babel.config.js.ejs +13 -16
- package/build/templates/base/components/Button.tsx.ejs +1 -0
- package/build/templates/base/components/Container.tsx.ejs +1 -0
- package/build/templates/base/package.json.ejs +34 -67
- package/build/templates/base/tsconfig.json.ejs +12 -7
- package/build/templates/packages/expo-router/drawer/app/+not-found.tsx.ejs +19 -60
- package/build/templates/packages/expo-router/drawer/app/_layout.tsx.ejs +2 -41
- package/build/templates/packages/expo-router/stack/app/+not-found.tsx.ejs +34 -66
- package/build/templates/packages/expo-router/stack/app/_layout.tsx.ejs +15 -51
- package/build/templates/packages/expo-router/stack/app/details.tsx.ejs +37 -5
- package/build/templates/packages/expo-router/stack/app/index.tsx.ejs +34 -11
- package/build/templates/packages/expo-router/tabs/app/+not-found.tsx.ejs +21 -60
- package/build/templates/packages/expo-router/tabs/app/_layout.tsx.ejs +8 -48
- package/build/templates/packages/nativewind/global.css +3 -2
- package/build/templates/packages/nativewind/metro.config.js +3 -4
- package/build/templates/packages/nativewind/nativewind-env.d.ts +1 -3
- package/build/templates/packages/nativewind/tailwind.config.js.ejs +15 -0
- package/build/templates/packages/nativewindui/components/Container.tsx.ejs +1 -0
- package/build/templates/packages/nativewindui/components/EditScreenInfo.tsx.ejs +1 -1
- package/build/templates/packages/nativewindui/components/ScreenContent.tsx.ejs +1 -1
- 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/{ThemeToggle.tsx.ejs → nativewindui/ThemeToggle.tsx.ejs} +8 -10
- package/build/templates/packages/nativewindui/drawer/app/(drawer)/index.tsx.ejs +17 -19
- package/build/templates/packages/nativewindui/drawer/app/+not-found.tsx.ejs +4 -44
- package/build/templates/packages/nativewindui/drawer/app/_layout.tsx.ejs +2 -2
- package/build/templates/packages/nativewindui/drawer/app/modal.tsx.ejs +4 -4
- package/build/templates/packages/nativewindui/lib/useColorScheme.tsx.ejs +3 -37
- package/build/templates/packages/nativewindui/stack/app/+not-found.tsx.ejs +1 -1
- package/build/templates/packages/nativewindui/stack/app/_layout.tsx.ejs +17 -34
- package/build/templates/packages/nativewindui/stack/app/index.tsx.ejs +230 -275
- package/build/templates/packages/nativewindui/stack/app/modal.tsx.ejs +7 -7
- package/build/templates/packages/nativewindui/tabs/app/(tabs)/index.tsx.ejs +6 -7
- package/build/templates/packages/nativewindui/tabs/app/+not-found.tsx.ejs +0 -40
- package/build/templates/packages/nativewindui/theme/colors.ts.ejs +52 -0
- package/build/templates/packages/nativewindui/theme/index.ts.ejs +2 -2
- package/build/templates/packages/nativewindui/theme/with-opacity.ts.ejs +155 -0
- package/build/templates/packages/react-navigation/App.tsx.ejs +2 -42
- package/build/types/constants.d.ts +1 -1
- package/build/types/types.d.ts +3 -3
- package/build/types/utilities/configAnalytics.d.ts +2 -2
- package/build/types.js +1 -3
- package/build/utilities/clearNavigationPackages.js +2 -2
- package/build/utilities/clearStylingPackages.js +2 -2
- package/build/utilities/configAnalytics.js +5 -4
- package/build/utilities/configureProjectFiles.js +31 -68
- package/build/utilities/copyBaseAssets.js +3 -2
- package/build/utilities/generateNWUI.js +8 -7
- package/build/utilities/generateProjectFiles.js +4 -9
- package/build/utilities/getPackageManager.js +6 -5
- package/build/utilities/printOutput.js +5 -16
- package/build/utilities/renderTitle.js +3 -2
- package/build/utilities/runCLI.js +15 -17
- package/build/utilities/runEasConfigure.js +3 -2
- package/build/utilities/runIgnite.js +3 -2
- package/build/utilities/showHelp.js +3 -4
- package/build/utilities/systemCommand.js +3 -3
- package/build/utilities/usePackage.js +3 -2
- package/build/utilities/validateProjectName.js +3 -2
- package/package.json +73 -71
- package/build/templates/packages/nativewind/postcss.config.mjs +0 -5
- package/build/templates/packages/nativewindui/components/BackButton.tsx.ejs +0 -23
- package/build/templates/packages/nativewindui/components/Button.tsx.ejs +0 -41
- package/build/templates/packages/nativewindui/lib/useHeaderSearchBar.tsx.ejs +0 -31
- package/build/templates/packages/restyle/components/BackButton.tsx.ejs +0 -15
- package/build/templates/packages/restyle/components/Button.tsx.ejs +0 -40
- package/build/templates/packages/restyle/components/Container.tsx.ejs +0 -6
- package/build/templates/packages/restyle/components/EditScreenInfo.tsx.ejs +0 -29
- package/build/templates/packages/restyle/components/ScreenContent.tsx.ejs +0 -21
- package/build/templates/packages/restyle/theme/Box.tsx.ejs +0 -6
- package/build/templates/packages/restyle/theme/Text.tsx.ejs +0 -6
- package/build/templates/packages/restyle/theme/index.ts.ejs +0 -6
- package/build/templates/packages/restyle/theme/theme.ts.ejs +0 -67
- package/build/templates/packages/tamagui/components/BackButton.tsx.ejs +0 -19
- package/build/templates/packages/tamagui/components/Button.tsx.ejs +0 -18
- package/build/templates/packages/tamagui/components/Container.tsx.ejs +0 -6
- package/build/templates/packages/tamagui/components/EditScreenInfo.tsx.ejs +0 -29
- package/build/templates/packages/tamagui/components/ScreenContent.tsx.ejs +0 -23
- package/build/templates/packages/tamagui/tamagui.config.ts.ejs +0 -130
|
@@ -9,23 +9,7 @@
|
|
|
9
9
|
<% if (props.internalizationPackage?.name === "i18next") { %>
|
|
10
10
|
import '../translation';
|
|
11
11
|
<% } %>
|
|
12
|
-
|
|
13
|
-
<% if (props.stylingPackage?.name === "tamagui") { %>
|
|
14
|
-
import React, { useEffect } from "react";
|
|
15
|
-
import { TamaguiProvider } from 'tamagui'
|
|
16
|
-
import { SplashScreen, Stack } from "expo-router";
|
|
17
|
-
import { useFonts } from "expo-font";
|
|
18
|
-
|
|
19
|
-
import config from '../tamagui.config'
|
|
20
|
-
|
|
21
|
-
SplashScreen.preventAutoHideAsync();
|
|
22
|
-
<% } else if (props.stylingPackage?.name === "restyle") { %>
|
|
23
|
-
import { ThemeProvider } from '@shopify/restyle';
|
|
24
|
-
import { Stack } from 'expo-router';
|
|
25
|
-
import { theme } from 'theme';
|
|
26
|
-
<% } else { %>
|
|
27
12
|
import { Stack } from "expo-router";
|
|
28
|
-
<% } %>
|
|
29
13
|
|
|
30
14
|
<% if (props.analyticsPackage?.name === "vexo-analytics") { %>
|
|
31
15
|
import { vexo } from 'vexo-analytics';
|
|
@@ -39,30 +23,11 @@ export const unstable_settings = {
|
|
|
39
23
|
};
|
|
40
24
|
|
|
41
25
|
export default function RootLayout() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
InterBold: require("@tamagui/font-inter/otf/Inter-Bold.otf")
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (loaded) {
|
|
50
|
-
SplashScreen.hideAsync();
|
|
51
|
-
}
|
|
52
|
-
}, [loaded]);
|
|
53
|
-
|
|
54
|
-
if (!loaded) return null;
|
|
55
|
-
<% } %>
|
|
56
|
-
<% if (props.stylingPackage?.name === "unistyles") { %>
|
|
57
|
-
const { theme } = useUnistyles();
|
|
58
|
-
<% } %>
|
|
26
|
+
<% if (props.stylingPackage?.name === "unistyles") { %>
|
|
27
|
+
const { theme } = useUnistyles();
|
|
28
|
+
<% } %>
|
|
59
29
|
|
|
60
|
-
|
|
61
|
-
<% if (props.stylingPackage?.name === "tamagui") { %>
|
|
62
|
-
<TamaguiProvider config={config}>
|
|
63
|
-
<% } else if (props.stylingPackage?.name === "restyle") { %>
|
|
64
|
-
<ThemeProvider theme={theme}>
|
|
65
|
-
<% } %>
|
|
30
|
+
return (
|
|
66
31
|
<% if (props.stylingPackage?.name === "unistyles") { %>
|
|
67
32
|
<Stack
|
|
68
33
|
screenOptions={{
|
|
@@ -78,13 +43,8 @@ export default function RootLayout() {
|
|
|
78
43
|
<% } else { %>
|
|
79
44
|
<Stack>
|
|
80
45
|
<% } %>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</TamaguiProvider>
|
|
86
|
-
<% } else if (props.stylingPackage?.name === "restyle") { %>
|
|
87
|
-
</ThemeProvider>
|
|
88
|
-
<% } %>
|
|
89
|
-
);
|
|
46
|
+
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
47
|
+
<Stack.Screen name="modal" options={{ presentation: "modal" }} />
|
|
48
|
+
</Stack>
|
|
49
|
+
);
|
|
90
50
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
// Learn more https://docs.expo.io/guides/customizing-metro
|
|
2
1
|
const { getDefaultConfig } = require('expo/metro-config');
|
|
3
|
-
const {
|
|
2
|
+
const { withNativeWind } = require('nativewind/metro');
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
// eslint-disable-next-line no-undef
|
|
6
5
|
const config = getDefaultConfig(__dirname);
|
|
7
6
|
|
|
8
|
-
module.exports =
|
|
7
|
+
module.exports = withNativeWind(config, { input: './global.css' });
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
/// <reference types="
|
|
3
|
-
|
|
4
|
-
// NOTE: This file should not be edited and should be committed with your source code. It is generated by react-native-css. If you need to move or disable this file, please see the documentation.
|
|
2
|
+
/// <reference types="nativewind/types" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
<% if (props.navigationPackage?.name === "react-navigation") { %>
|
|
4
|
+
content: ["./App.{js,ts,tsx}", "./components/**/*.{js,ts,tsx}", "./screens/**/*.{js,ts,tsx}", "./navigation/**/*.{js,ts,tsx}"],
|
|
5
|
+
<% } else if (props.navigationPackage?.name === "expo-router") { %>
|
|
6
|
+
content: ["./app/**/*.{js,ts,tsx}", "./components/**/*.{js,ts,tsx}"],
|
|
7
|
+
<% } else { %>
|
|
8
|
+
content: ["./App.{js,ts,tsx}", "./components/**/*.{js,ts,tsx}"],
|
|
9
|
+
<% } %>
|
|
10
|
+
presets: [require("nativewind/preset")],
|
|
11
|
+
theme: {
|
|
12
|
+
extend: {},
|
|
13
|
+
},
|
|
14
|
+
plugins: [],
|
|
15
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet, View } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { Text } from '
|
|
3
|
+
import { Text } from '@/components/nativewindui/Text';
|
|
4
4
|
|
|
5
5
|
<% if (props.internalizationPackage?.name === "i18next") { %>
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { SymbolView } from 'expo-symbols';
|
|
2
|
+
|
|
3
|
+
import type { IconProps } from './types';
|
|
4
|
+
|
|
5
|
+
import { useColorScheme } from '@/lib/useColorScheme';
|
|
6
|
+
|
|
7
|
+
function Icon({
|
|
8
|
+
materialCommunityIcon: _materialCommunityIcon,
|
|
9
|
+
materialIcon: _materialIcon,
|
|
10
|
+
sfSymbol,
|
|
11
|
+
name,
|
|
12
|
+
color,
|
|
13
|
+
size = 24,
|
|
14
|
+
...props
|
|
15
|
+
}: IconProps) {
|
|
16
|
+
const { colors } = useColorScheme();
|
|
17
|
+
return (
|
|
18
|
+
<SymbolView
|
|
19
|
+
name={name ?? 'questionmark'}
|
|
20
|
+
tintColor={rgbaToHex(color ?? colors.foreground)}
|
|
21
|
+
size={size}
|
|
22
|
+
resizeMode="scaleAspectFit"
|
|
23
|
+
{...props}
|
|
24
|
+
{...sfSymbol}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { Icon };
|
|
30
|
+
|
|
31
|
+
// TODO: seems like the need to convert rgba to hex color is a bug in expo-symbols, accordion to the docs, it should accept a hex color, but it doesn't.
|
|
32
|
+
|
|
33
|
+
function rgbaToHex(color: string): string {
|
|
34
|
+
if (!color) return 'black';
|
|
35
|
+
const rgbaRegex =
|
|
36
|
+
/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i;
|
|
37
|
+
const match = color.match(rgbaRegex);
|
|
38
|
+
|
|
39
|
+
if (!match) {
|
|
40
|
+
return color;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const [, rStr, gStr, bStr, aStr] = match;
|
|
44
|
+
const r = Math.min(255, parseInt(rStr));
|
|
45
|
+
const g = Math.min(255, parseInt(gStr));
|
|
46
|
+
const b = Math.min(255, parseInt(bStr));
|
|
47
|
+
const a = aStr !== undefined ? Math.round(parseFloat(aStr) * 255) : 255;
|
|
48
|
+
|
|
49
|
+
const toHex = (n: number) => n.toString(16).padStart(2, '0');
|
|
50
|
+
|
|
51
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}${a < 255 ? toHex(a) : ''}`;
|
|
52
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
2
|
+
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
|
3
|
+
import {
|
|
4
|
+
SF_SYMBOLS_TO_MATERIAL_COMMUNITY_ICONS,
|
|
5
|
+
SF_SYMBOLS_TO_MATERIAL_ICONS,
|
|
6
|
+
} from 'rn-icon-mapper';
|
|
7
|
+
|
|
8
|
+
import type { IconProps } from './types';
|
|
9
|
+
|
|
10
|
+
import { useColorScheme } from '@/lib/useColorScheme';
|
|
11
|
+
|
|
12
|
+
function Icon({
|
|
13
|
+
name,
|
|
14
|
+
materialCommunityIcon,
|
|
15
|
+
materialIcon,
|
|
16
|
+
sfSymbol: _sfSymbol,
|
|
17
|
+
size = 24,
|
|
18
|
+
...props
|
|
19
|
+
}: IconProps) {
|
|
20
|
+
const { colors } = useColorScheme();
|
|
21
|
+
const defaultColor = colors.foreground;
|
|
22
|
+
|
|
23
|
+
if (materialCommunityIcon) {
|
|
24
|
+
return (
|
|
25
|
+
<MaterialCommunityIcons
|
|
26
|
+
size={size}
|
|
27
|
+
color={defaultColor}
|
|
28
|
+
{...props}
|
|
29
|
+
{...materialCommunityIcon}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
if (materialIcon) {
|
|
34
|
+
return <MaterialIcons size={size} color={defaultColor} {...props} {...materialIcon} />;
|
|
35
|
+
}
|
|
36
|
+
const materialCommunityIconName =
|
|
37
|
+
SF_SYMBOLS_TO_MATERIAL_COMMUNITY_ICONS[
|
|
38
|
+
name as keyof typeof SF_SYMBOLS_TO_MATERIAL_COMMUNITY_ICONS
|
|
39
|
+
];
|
|
40
|
+
if (materialCommunityIconName) {
|
|
41
|
+
return (
|
|
42
|
+
<MaterialCommunityIcons
|
|
43
|
+
name={materialCommunityIconName}
|
|
44
|
+
size={size}
|
|
45
|
+
color={defaultColor}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const materialIconName =
|
|
51
|
+
SF_SYMBOLS_TO_MATERIAL_ICONS[name as keyof typeof SF_SYMBOLS_TO_MATERIAL_ICONS];
|
|
52
|
+
if (materialIconName) {
|
|
53
|
+
return <MaterialIcons name={materialIconName} size={size} color={defaultColor} {...props} />;
|
|
54
|
+
}
|
|
55
|
+
return <MaterialCommunityIcons name="help" size={size} color={defaultColor} {...props} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { Icon };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { cssInterop } from 'nativewind';
|
|
2
|
+
|
|
3
|
+
import { Icon } from './Icon';
|
|
4
|
+
|
|
5
|
+
cssInterop(Icon, {
|
|
6
|
+
className: {
|
|
7
|
+
target: 'style',
|
|
8
|
+
nativeStyleToProp: {
|
|
9
|
+
color: 'color',
|
|
10
|
+
height: 'size',
|
|
11
|
+
width: 'size',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { Icon };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
2
|
+
import type MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
|
3
|
+
import type { SymbolViewProps } from 'expo-symbols';
|
|
4
|
+
import type { IconMapper } from 'rn-icon-mapper';
|
|
5
|
+
|
|
6
|
+
type MaterialCommunityIconsProps = React.ComponentProps<typeof MaterialCommunityIcons>;
|
|
7
|
+
type MaterialIconsProps = React.ComponentProps<typeof MaterialIcons>;
|
|
8
|
+
|
|
9
|
+
type Style = SymbolViewProps['style'] &
|
|
10
|
+
MaterialIconsProps['style'] &
|
|
11
|
+
MaterialCommunityIconsProps['style'];
|
|
12
|
+
|
|
13
|
+
type IconProps = IconMapper<SymbolViewProps, MaterialIconsProps, MaterialCommunityIconsProps> & {
|
|
14
|
+
style?: Style;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type { IconProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Icon } from '@roninoss/icons';
|
|
2
1
|
import { Pressable, View } from 'react-native';
|
|
3
2
|
import Animated, { LayoutAnimationConfig, ZoomInRotate } from 'react-native-reanimated';
|
|
4
3
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { Icon } from '@/components/nativewindui/Icon';
|
|
5
|
+
import { cn } from '@/lib/cn';
|
|
6
|
+
import { useColorScheme } from '@/lib/useColorScheme';
|
|
7
|
+
import { COLORS } from '@/theme/colors';
|
|
8
8
|
|
|
9
9
|
export function ThemeToggle() {
|
|
10
10
|
const { colorScheme, toggleColorScheme } = useColorScheme();
|
|
@@ -14,22 +14,20 @@ export function ThemeToggle() {
|
|
|
14
14
|
className="items-center justify-center"
|
|
15
15
|
key={`toggle-${colorScheme}`}
|
|
16
16
|
entering={ZoomInRotate}>
|
|
17
|
-
<Pressable
|
|
18
|
-
onPress={toggleColorScheme}
|
|
19
|
-
className="opacity-80">
|
|
17
|
+
<Pressable onPress={toggleColorScheme} className="opacity-80">
|
|
20
18
|
{colorScheme === 'dark'
|
|
21
19
|
? ({ pressed }) => (
|
|
22
20
|
<View className={cn('px-0.5', pressed && 'opacity-50')}>
|
|
23
|
-
<Icon
|
|
21
|
+
<Icon name="moon.stars" color={COLORS.white} />
|
|
24
22
|
</View>
|
|
25
23
|
)
|
|
26
24
|
: ({ pressed }) => (
|
|
27
25
|
<View className={cn('px-0.5', pressed && 'opacity-50')}>
|
|
28
|
-
<Icon
|
|
26
|
+
<Icon name="sun.min" color={COLORS.black} />
|
|
29
27
|
</View>
|
|
30
28
|
)}
|
|
31
29
|
</Pressable>
|
|
32
30
|
</Animated.View>
|
|
33
31
|
</LayoutAnimationConfig>
|
|
34
32
|
);
|
|
35
|
-
}
|
|
33
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Stack } from 'expo-router';
|
|
2
2
|
import { useHeaderHeight } from '@react-navigation/elements';
|
|
3
|
-
import {
|
|
3
|
+
import { FlashList } from '@shopify/flash-list';
|
|
4
4
|
import { cssInterop } from 'nativewind';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import {
|
|
@@ -32,34 +32,33 @@ import { Icon } from '@roninoss/icons';
|
|
|
32
32
|
import * as StoreReview from 'expo-store-review';
|
|
33
33
|
<% } %>
|
|
34
34
|
|
|
35
|
-
import { Container } from '
|
|
35
|
+
import { Container } from '@/components/Container';
|
|
36
36
|
<% if (props.stylingPackage?.options.selectedComponents.includes('activity-indicator')) { %>
|
|
37
|
-
import { ActivityIndicator } from '
|
|
37
|
+
import { ActivityIndicator } from '@/components/nativewindui/ActivityIndicator';
|
|
38
38
|
<% } %>
|
|
39
39
|
<% if (props.stylingPackage?.options.selectedComponents.includes('avatar')) { %>
|
|
40
|
-
import { Avatar, AvatarFallback, AvatarImage } from '
|
|
40
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/nativewindui/Avatar';
|
|
41
41
|
<% } %>
|
|
42
42
|
<% if (props.stylingPackage?.options.selectedComponents.includes('date-picker')) { %>
|
|
43
|
-
import { DatePicker } from '
|
|
43
|
+
import { DatePicker } from '@/components/nativewindui/DatePicker';
|
|
44
44
|
<% } %>
|
|
45
45
|
<% if (props.stylingPackage?.options.selectedComponents.includes('picker')) { %>
|
|
46
|
-
import { Picker, PickerItem } from '
|
|
46
|
+
import { Picker, PickerItem } from '@/components/nativewindui/Picker';
|
|
47
47
|
<% } %>
|
|
48
48
|
<% if (props.stylingPackage?.options.selectedComponents.includes('progress-indicator')) { %>
|
|
49
|
-
import { ProgressIndicator } from '
|
|
49
|
+
import { ProgressIndicator } from '@/components/nativewindui/ProgressIndicator';
|
|
50
50
|
<% } %>
|
|
51
51
|
<% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
|
|
52
|
-
import { Sheet, useSheetRef } from '
|
|
52
|
+
import { Sheet, useSheetRef } from '@/components/nativewindui/Sheet';
|
|
53
53
|
<% } %>
|
|
54
54
|
<% if (props.stylingPackage?.options.selectedComponents.includes('slider')) { %>
|
|
55
|
-
import { Slider } from '
|
|
55
|
+
import { Slider } from '@/components/nativewindui/Slider';
|
|
56
56
|
<% } %>
|
|
57
|
-
import { Text } from '
|
|
57
|
+
import { Text } from '@/components/nativewindui/Text';
|
|
58
58
|
<% if (props.stylingPackage?.options.selectedComponents.includes('toggle')) { %>
|
|
59
|
-
import { Toggle } from '
|
|
59
|
+
import { Toggle } from '@/components/nativewindui/Toggle';
|
|
60
60
|
<% } %>
|
|
61
|
-
import { useColorScheme } from '
|
|
62
|
-
import { useHeaderSearchBar } from '~/lib/useHeaderSearchBar';
|
|
61
|
+
import { useColorScheme } from '@/lib/useColorScheme';
|
|
63
62
|
|
|
64
63
|
export default function Home() {
|
|
65
64
|
const searchValue = useHeaderSearchBar({ hideWhenScrolling: COMPONENTS.length === 0 });
|
|
@@ -72,7 +71,7 @@ export default function Home() {
|
|
|
72
71
|
<>
|
|
73
72
|
<Stack.Screen options={{ title: 'Home' }} />
|
|
74
73
|
<Container>
|
|
75
|
-
<
|
|
74
|
+
<FlashList
|
|
76
75
|
contentInsetAdjustmentBehavior="automatic"
|
|
77
76
|
keyboardShouldPersistTaps="handled"
|
|
78
77
|
data={data}
|
|
@@ -83,14 +82,13 @@ export default function Home() {
|
|
|
83
82
|
ItemSeparatorComponent={renderItemSeparator}
|
|
84
83
|
renderItem={renderItem}
|
|
85
84
|
ListEmptyComponent={COMPONENTS.length === 0 ? ListEmptyComponent : undefined}
|
|
86
|
-
recycleItems
|
|
87
85
|
/>
|
|
88
86
|
</Container>
|
|
89
87
|
</>
|
|
90
88
|
);
|
|
91
89
|
}
|
|
92
90
|
|
|
93
|
-
cssInterop(
|
|
91
|
+
cssInterop(FlashList, {
|
|
94
92
|
className: 'style',
|
|
95
93
|
contentContainerClassName: 'contentContainerStyle',
|
|
96
94
|
});
|
|
@@ -125,7 +123,7 @@ function ListEmptyComponent() {
|
|
|
125
123
|
variant='subhead'
|
|
126
124
|
className='text-primary'
|
|
127
125
|
>
|
|
128
|
-
|
|
126
|
+
NativewindUI
|
|
129
127
|
</Text>
|
|
130
128
|
{' website.'}
|
|
131
129
|
</Text>
|
|
@@ -466,7 +464,7 @@ const COMPONENTS: ComponentItem[] = [
|
|
|
466
464
|
onPress={async () => {
|
|
467
465
|
try {
|
|
468
466
|
const result = await Share.share({
|
|
469
|
-
message: '
|
|
467
|
+
message: 'NativewindUI | Familiar interface, native feel.',
|
|
470
468
|
});
|
|
471
469
|
if (result.action === Share.sharedAction) {
|
|
472
470
|
if (result.activityType) {
|
|
@@ -523,7 +521,7 @@ const COMPONENTS: ComponentItem[] = [
|
|
|
523
521
|
const TWITTER_AVATAR_URI = 'https://pbs.twimg.com/profile_images/1782428433898708992/1voyv4_A_400x400.jpg';
|
|
524
522
|
return (
|
|
525
523
|
<View className='items-center'>
|
|
526
|
-
<Avatar alt="
|
|
524
|
+
<Avatar alt="NativewindUI Avatar">
|
|
527
525
|
<AvatarImage source={{ uri: TWITTER_AVATAR_URI }} />
|
|
528
526
|
<AvatarFallback>
|
|
529
527
|
<Text>NUI</Text>
|
|
@@ -2,29 +2,20 @@ import { Link, Stack } from 'expo-router';
|
|
|
2
2
|
<% if (["nativewind", "nativewindui"].includes(props.stylingPackage?.name)) {%>
|
|
3
3
|
import { Text } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import { Container } from '
|
|
5
|
+
import { Container } from '@/components/Container';
|
|
6
6
|
<% } else if (props.stylingPackage?.name === "unistyles") { %>
|
|
7
7
|
import { createStyleSheet, useStyles } from 'react-native-unistyles'
|
|
8
8
|
import { Text } from 'react-native';
|
|
9
9
|
|
|
10
|
-
import { Container } from '
|
|
10
|
+
import { Container } from '@/components/Container';
|
|
11
11
|
<% } else if (props.stylingPackage?.name === "stylesheet") { %>
|
|
12
12
|
import { StyleSheet, Text } from 'react-native';
|
|
13
13
|
|
|
14
|
-
import { Container } from '
|
|
15
|
-
<% } else if (props.stylingPackage?.name === "tamagui") { %>
|
|
16
|
-
import { YStack } from "tamagui";
|
|
17
|
-
import { Container, Main, Subtitle, Title } from "../tamagui.config";
|
|
18
|
-
<% } else if (props.stylingPackage?.name === "restyle") { %>
|
|
19
|
-
import { Box, Text, makeStyles } from 'theme';
|
|
20
|
-
|
|
21
|
-
import { Container } from '~/components/Container';
|
|
14
|
+
import { Container } from '@/components/Container';
|
|
22
15
|
<% } %>
|
|
23
16
|
|
|
24
17
|
export default function NotFoundScreen() {
|
|
25
|
-
<% if (props.stylingPackage?.name === "
|
|
26
|
-
const styles = useStyles();
|
|
27
|
-
<% } else if (props.stylingPackage?.name === "unistyles") {%>
|
|
18
|
+
<% if (props.stylingPackage?.name === "unistyles") {%>
|
|
28
19
|
const { styles } = useStyles(stylesheet);
|
|
29
20
|
<% } %>
|
|
30
21
|
|
|
@@ -39,30 +30,6 @@ export default function NotFoundScreen() {
|
|
|
39
30
|
</Link>
|
|
40
31
|
</Container>
|
|
41
32
|
</>
|
|
42
|
-
<% } else if (props.stylingPackage?.name === "tamagui") {%>
|
|
43
|
-
<Container>
|
|
44
|
-
<Stack.Screen options={{ title: "Oops!" }} />
|
|
45
|
-
<Main>
|
|
46
|
-
<YStack>
|
|
47
|
-
<Title>{"This screen doesn't exist."}</Title>
|
|
48
|
-
<Link href="/">
|
|
49
|
-
<Subtitle>Go to home screen!</Subtitle>
|
|
50
|
-
</Link>
|
|
51
|
-
</YStack>
|
|
52
|
-
</Main>
|
|
53
|
-
</Container>
|
|
54
|
-
<% } else if (props.stylingPackage?.name === "restyle") {%>
|
|
55
|
-
<>
|
|
56
|
-
<Stack.Screen options={{ title: 'Oops!' }} />
|
|
57
|
-
<Container>
|
|
58
|
-
<Text variant="title">{"This screen doesn't exist."}</Text>
|
|
59
|
-
<Link href="/" style={styles.link}>
|
|
60
|
-
<Text variant="body" color="blue">
|
|
61
|
-
Go to home screen!
|
|
62
|
-
</Text>
|
|
63
|
-
</Link>
|
|
64
|
-
</Container>
|
|
65
|
-
</>
|
|
66
33
|
<% } else { %>
|
|
67
34
|
<>
|
|
68
35
|
<Stack.Screen options={{ title: "Oops!" }} />
|
|
@@ -113,11 +80,4 @@ export default function NotFoundScreen() {
|
|
|
113
80
|
color: '#2e78b7',
|
|
114
81
|
},
|
|
115
82
|
});
|
|
116
|
-
<% } else if (props.stylingPackage?.name === "restyle") { %>
|
|
117
|
-
const useStyles = makeStyles((theme) => ({
|
|
118
|
-
link: {
|
|
119
|
-
marginTop: theme.spacing.m_16,
|
|
120
|
-
paddingVertical: theme.spacing.m_16,
|
|
121
|
-
},
|
|
122
|
-
}));
|
|
123
83
|
<% } %>
|
|
@@ -13,8 +13,8 @@ import { StatusBar } from 'expo-status-bar';
|
|
|
13
13
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
14
14
|
<% } %>
|
|
15
15
|
|
|
16
|
-
import { ThemeToggle } from '
|
|
17
|
-
import { useColorScheme, useInitialAndroidBarSync } from '
|
|
16
|
+
import { ThemeToggle } from '@/components/ThemeToggle';
|
|
17
|
+
import { useColorScheme, useInitialAndroidBarSync } from '@/lib/useColorScheme';
|
|
18
18
|
import { NAV_THEME } from '~/theme';
|
|
19
19
|
|
|
20
20
|
export {
|
|
@@ -2,8 +2,8 @@ import { Icon } from '@roninoss/icons';
|
|
|
2
2
|
import { StatusBar } from 'expo-status-bar';
|
|
3
3
|
import { Linking, Platform, View } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import { Text } from '
|
|
6
|
-
import { useColorScheme } from '
|
|
5
|
+
import { Text } from '@/components/nativewindui/Text';
|
|
6
|
+
import { useColorScheme } from '@/lib/useColorScheme';
|
|
7
7
|
|
|
8
8
|
export default function ModalScreen() {
|
|
9
9
|
const { colors, colorScheme } = useColorScheme();
|
|
@@ -15,7 +15,7 @@ export default function ModalScreen() {
|
|
|
15
15
|
<View className="flex-1 items-center justify-center gap-1 px-12">
|
|
16
16
|
<Icon name="file-plus-outline" size={42} color={colors.grey} />
|
|
17
17
|
<Text variant="title3" className="pb-1 text-center font-semibold">
|
|
18
|
-
|
|
18
|
+
NativewindUI
|
|
19
19
|
</Text>
|
|
20
20
|
<Text color="tertiary" variant="subhead" className="pb-4 text-center">
|
|
21
21
|
You can install any of the free components from the{' '}
|
|
@@ -23,7 +23,7 @@ export default function ModalScreen() {
|
|
|
23
23
|
onPress={() => Linking.openURL('https://nativewindui.com')}
|
|
24
24
|
variant="subhead"
|
|
25
25
|
className="text-primary">
|
|
26
|
-
|
|
26
|
+
NativewindUI
|
|
27
27
|
</Text>
|
|
28
28
|
{' website.'}
|
|
29
29
|
</Text>
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import * as NavigationBar from 'expo-navigation-bar';
|
|
2
1
|
import { useColorScheme as useNativewindColorScheme } from 'nativewind';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Platform } from 'react-native';
|
|
5
2
|
|
|
6
|
-
import { COLORS } from '
|
|
3
|
+
import { COLORS } from '@/theme/colors';
|
|
7
4
|
|
|
8
5
|
function useColorScheme() {
|
|
9
|
-
const { colorScheme, setColorScheme
|
|
10
|
-
|
|
11
|
-
async function setColorScheme(colorScheme: 'light' | 'dark') {
|
|
12
|
-
setNativeWindColorScheme(colorScheme);
|
|
13
|
-
if (Platform.OS !== 'android') return;
|
|
14
|
-
try {
|
|
15
|
-
await setNavigationBar(colorScheme);
|
|
16
|
-
} catch (error) {
|
|
17
|
-
console.error('useColorScheme.tsx", "setColorScheme', error);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
6
|
+
const { colorScheme, setColorScheme } = useNativewindColorScheme();
|
|
20
7
|
|
|
21
8
|
function toggleColorScheme() {
|
|
22
9
|
return setColorScheme(colorScheme === 'light' ? 'dark' : 'light');
|
|
@@ -31,25 +18,4 @@ function useColorScheme() {
|
|
|
31
18
|
};
|
|
32
19
|
}
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
* Set the Android navigation bar color based on the color scheme.
|
|
36
|
-
*/
|
|
37
|
-
function useInitialAndroidBarSync() {
|
|
38
|
-
const { colorScheme } = useColorScheme();
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
if (Platform.OS !== 'android') return;
|
|
41
|
-
setNavigationBar(colorScheme).catch((error) => {
|
|
42
|
-
console.error('useColorScheme.tsx", "useInitialColorScheme', error);
|
|
43
|
-
});
|
|
44
|
-
}, [colorScheme]);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { useColorScheme, useInitialAndroidBarSync };
|
|
48
|
-
|
|
49
|
-
function setNavigationBar(colorScheme: 'light' | 'dark') {
|
|
50
|
-
return Promise.all([
|
|
51
|
-
NavigationBar.setButtonStyleAsync(colorScheme === 'dark' ? 'light' : 'dark'),
|
|
52
|
-
NavigationBar.setPositionAsync('absolute'),
|
|
53
|
-
NavigationBar.setBackgroundColorAsync(colorScheme === 'dark' ? '#00000030' : '#ffffff80'),
|
|
54
|
-
]);
|
|
55
|
-
}
|
|
21
|
+
export { useColorScheme };
|