nwui-cli 0.4.0 → 0.4.1-staging.1
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/index.js +8 -3
- package/build/install-component.js +41 -2
- package/build/utils/env.js +1 -1
- package/package.json +1 -1
- package/test-app/app/+html.tsx +46 -0
- package/test-app/app/+not-found.tsx +25 -0
- package/test-app/app/_layout.tsx +7 -0
- package/test-app/app/details.tsx +20 -0
- package/test-app/app/index.tsx +19 -0
- package/test-app/app-env.d.ts +2 -0
- package/test-app/app.json +41 -0
- package/test-app/assets/adaptive-icon.png +0 -0
- package/test-app/assets/favicon.png +0 -0
- package/test-app/assets/icon.png +0 -0
- package/test-app/assets/splash.png +0 -0
- package/test-app/babel.config.js +13 -0
- package/test-app/cesconfig.json +35 -0
- package/test-app/components/Button.tsx +25 -0
- package/test-app/components/Container.tsx +9 -0
- package/test-app/components/EditScreenInfo.tsx +31 -0
- package/test-app/components/ScreenContent.tsx +29 -0
- package/test-app/components/nativewindui/ActivityIndicator.tsx +13 -0
- package/test-app/components/nativewindui/Avatar.tsx +133 -0
- package/test-app/components/nativewindui/DatePicker/DatePicker.android.tsx +72 -0
- package/test-app/components/nativewindui/DatePicker/DatePicker.tsx +23 -0
- package/test-app/components/nativewindui/DatePicker/index.ts +1 -0
- package/test-app/components/nativewindui/Picker.tsx +42 -0
- package/test-app/components/nativewindui/ProgressIndicator.tsx +78 -0
- package/test-app/components/nativewindui/Sheet.tsx +52 -0
- package/test-app/components/nativewindui/Slider.tsx +26 -0
- package/test-app/components/nativewindui/Text.tsx +55 -0
- package/test-app/components/nativewindui/Toggle.tsx +20 -0
- package/test-app/global.css +3 -0
- package/test-app/metro.config.js +10 -0
- package/test-app/package.json +64 -0
- package/test-app/prettier.config.js +10 -0
- package/test-app/tailwind.config.js +14 -0
- package/test-no-install/app/+html.tsx +46 -0
- package/test-no-install/app/+not-found.tsx +25 -0
- package/test-no-install/app/_layout.tsx +7 -0
- package/test-no-install/app/details.tsx +20 -0
- package/test-no-install/app/index.tsx +19 -0
- package/test-no-install/app-env.d.ts +2 -0
- package/test-no-install/app.json +41 -0
- package/test-no-install/assets/adaptive-icon.png +0 -0
- package/test-no-install/assets/favicon.png +0 -0
- package/test-no-install/assets/icon.png +0 -0
- package/test-no-install/assets/splash.png +0 -0
- package/test-no-install/babel.config.js +13 -0
- package/test-no-install/cesconfig.json +35 -0
- package/test-no-install/components/Button.tsx +25 -0
- package/test-no-install/components/Container.tsx +9 -0
- package/test-no-install/components/EditScreenInfo.tsx +31 -0
- package/test-no-install/components/ScreenContent.tsx +29 -0
- package/test-no-install/components/nativewindui/ActivityIndicator.tsx +13 -0
- package/test-no-install/components/nativewindui/Avatar.tsx +133 -0
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.android.tsx +72 -0
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.tsx +23 -0
- package/test-no-install/components/nativewindui/DatePicker/index.ts +1 -0
- package/test-no-install/components/nativewindui/Picker.tsx +42 -0
- package/test-no-install/components/nativewindui/ProgressIndicator.tsx +78 -0
- package/test-no-install/components/nativewindui/Sheet.tsx +52 -0
- package/test-no-install/components/nativewindui/Slider.tsx +26 -0
- package/test-no-install/components/nativewindui/Text.tsx +55 -0
- package/test-no-install/components/nativewindui/Toggle.tsx +20 -0
- package/test-no-install/global.css +3 -0
- package/test-no-install/metro.config.js +10 -0
- package/test-no-install/package.json +64 -0
- package/test-no-install/prettier.config.js +10 -0
- package/test-no-install/tailwind.config.js +14 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import DateTimePicker from '@react-native-community/datetimepicker';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
export function DatePicker({
|
|
5
|
+
materialDateClassName: _materialDateClassName,
|
|
6
|
+
materialDateLabel: _materialDateLabel,
|
|
7
|
+
materialDateLabelClassName: _materialDateLabelClassName,
|
|
8
|
+
materialTimeClassName: _materialTimeClassName,
|
|
9
|
+
materialTimeLabel: _materialTimeLabel,
|
|
10
|
+
materialTimeLabelClassName: _materialTimeLabelClassName,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof DateTimePicker> & {
|
|
13
|
+
mode: 'date' | 'time' | 'datetime';
|
|
14
|
+
} & {
|
|
15
|
+
materialDateClassName?: string;
|
|
16
|
+
materialDateLabel?: string;
|
|
17
|
+
materialDateLabelClassName?: string;
|
|
18
|
+
materialTimeClassName?: string;
|
|
19
|
+
materialTimeLabel?: string;
|
|
20
|
+
materialTimeLabelClassName?: string;
|
|
21
|
+
}) {
|
|
22
|
+
return <DateTimePicker {...props} />;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DatePicker';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Picker as RNPicker } from '@react-native-picker/picker';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { cn } from '~/lib/cn';
|
|
5
|
+
import { useColorScheme } from '~/lib/useColorScheme';
|
|
6
|
+
|
|
7
|
+
function Picker<T>({
|
|
8
|
+
mode = 'dropdown',
|
|
9
|
+
style,
|
|
10
|
+
dropdownIconColor,
|
|
11
|
+
dropdownIconRippleColor,
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentPropsWithoutRef<typeof RNPicker<T>>) {
|
|
15
|
+
const { colors } = useColorScheme();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<View
|
|
19
|
+
className={cn(
|
|
20
|
+
'ios:shadow-sm ios:shadow-black/5 rounded-md border border-background bg-background',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
>
|
|
24
|
+
<RNPicker
|
|
25
|
+
mode={mode}
|
|
26
|
+
style={
|
|
27
|
+
style ?? {
|
|
28
|
+
backgroundColor: colors.root,
|
|
29
|
+
borderRadius: 8,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
dropdownIconColor={dropdownIconColor ?? colors.foreground}
|
|
33
|
+
dropdownIconRippleColor={dropdownIconRippleColor ?? colors.foreground}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const PickerItem = RNPicker.Item;
|
|
41
|
+
|
|
42
|
+
export { Picker, PickerItem };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
Extrapolation,
|
|
5
|
+
interpolate,
|
|
6
|
+
useAnimatedStyle,
|
|
7
|
+
useDerivedValue,
|
|
8
|
+
withSpring,
|
|
9
|
+
} from 'react-native-reanimated';
|
|
10
|
+
|
|
11
|
+
import { cn } from '~/lib/cn';
|
|
12
|
+
|
|
13
|
+
const DEFAULT_MAX = 100;
|
|
14
|
+
|
|
15
|
+
const ProgressIndicator = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof View>,
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof View> & {
|
|
18
|
+
value?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
getValueLabel?: (value: number, max: number) => string;
|
|
21
|
+
}
|
|
22
|
+
>(
|
|
23
|
+
(
|
|
24
|
+
{
|
|
25
|
+
value: valueProp,
|
|
26
|
+
max: maxProp,
|
|
27
|
+
getValueLabel = defaultGetValueLabel,
|
|
28
|
+
className,
|
|
29
|
+
children,
|
|
30
|
+
...props
|
|
31
|
+
},
|
|
32
|
+
ref
|
|
33
|
+
) => {
|
|
34
|
+
const max = maxProp ?? DEFAULT_MAX;
|
|
35
|
+
const value = isValidValueNumber(valueProp, max) ? valueProp : 0;
|
|
36
|
+
const progress = useDerivedValue(() => value ?? 0);
|
|
37
|
+
|
|
38
|
+
const indicator = useAnimatedStyle(() => {
|
|
39
|
+
return {
|
|
40
|
+
width: withSpring(
|
|
41
|
+
`${interpolate(progress.value, [0, 100], [1, 100], Extrapolation.CLAMP)}%`,
|
|
42
|
+
{ overshootClamping: true }
|
|
43
|
+
),
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View
|
|
49
|
+
role="progressbar"
|
|
50
|
+
ref={ref}
|
|
51
|
+
aria-valuemax={max}
|
|
52
|
+
aria-valuemin={0}
|
|
53
|
+
aria-valuenow={value}
|
|
54
|
+
aria-valuetext={getValueLabel(value, max)}
|
|
55
|
+
accessibilityValue={{
|
|
56
|
+
min: 0,
|
|
57
|
+
max,
|
|
58
|
+
now: value,
|
|
59
|
+
text: getValueLabel(value, max),
|
|
60
|
+
}}
|
|
61
|
+
className={cn('relative h-1 w-full overflow-hidden rounded-full', className)}
|
|
62
|
+
{...props}>
|
|
63
|
+
<View className="absolute bottom-0 left-0 right-0 top-0 bg-muted opacity-20" />
|
|
64
|
+
<Animated.View role="presentation" style={indicator} className={cn('h-full bg-primary')} /></View> );
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
ProgressIndicator.displayName = 'ProgressIndicator';
|
|
69
|
+
|
|
70
|
+
export { ProgressIndicator };
|
|
71
|
+
|
|
72
|
+
function defaultGetValueLabel(value: number, max: number) {
|
|
73
|
+
return `${Math.round((value / max) * 100)}%`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function isValidValueNumber(value: any, max: number): value is number {
|
|
77
|
+
return typeof value === 'number' && !isNaN(value) && value <= max && value >= 0;
|
|
78
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BottomSheetBackdrop,
|
|
3
|
+
BottomSheetBackdropProps,
|
|
4
|
+
BottomSheetModal,
|
|
5
|
+
} from '@gorhom/bottom-sheet';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
import { useColorScheme } from '~/lib/useColorScheme';
|
|
9
|
+
|
|
10
|
+
const Sheet = React.forwardRef<
|
|
11
|
+
BottomSheetModal,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof BottomSheetModal>
|
|
13
|
+
>(({ index = 0, backgroundStyle, style, handleIndicatorStyle, ...props }, ref) => {
|
|
14
|
+
const { colors } = useColorScheme();
|
|
15
|
+
|
|
16
|
+
const renderBackdrop = React.useCallback(
|
|
17
|
+
(props: BottomSheetBackdropProps) => <BottomSheetBackdrop {...props} disappearsOnIndex={-1} />,
|
|
18
|
+
[]
|
|
19
|
+
);
|
|
20
|
+
return (
|
|
21
|
+
<BottomSheetModal
|
|
22
|
+
ref={ref}
|
|
23
|
+
index={0}
|
|
24
|
+
backgroundStyle={
|
|
25
|
+
backgroundStyle ?? {
|
|
26
|
+
backgroundColor: colors.card,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
style={
|
|
30
|
+
style ?? {
|
|
31
|
+
borderWidth: 1,
|
|
32
|
+
borderColor: colors.grey5,
|
|
33
|
+
borderTopStartRadius: 16,
|
|
34
|
+
borderTopEndRadius: 16,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
handleIndicatorStyle={
|
|
38
|
+
handleIndicatorStyle ?? {
|
|
39
|
+
backgroundColor: colors.grey4,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
backdropComponent={renderBackdrop}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function useSheetRef() {
|
|
49
|
+
return React.useRef<BottomSheetModal>(null);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { Sheet, useSheetRef };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import RNSlider from '@react-native-community/slider';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useColorScheme } from '~/lib/useColorScheme';
|
|
5
|
+
import { COLORS } from '~/theme/colors';
|
|
6
|
+
|
|
7
|
+
function Slider({
|
|
8
|
+
thumbTintColor,
|
|
9
|
+
minimumTrackTintColor,
|
|
10
|
+
maximumTrackTintColor,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentPropsWithoutRef<typeof RNSlider>) {
|
|
13
|
+
const { colors } = useColorScheme();
|
|
14
|
+
return (
|
|
15
|
+
<RNSlider
|
|
16
|
+
thumbTintColor={thumbTintColor ?? Platform.OS === 'ios' ? COLORS.white : colors.primary}
|
|
17
|
+
minimumTrackTintColor={minimumTrackTintColor ?? colors.primary}
|
|
18
|
+
maximumTrackTintColor={
|
|
19
|
+
maximumTrackTintColor ?? Platform.OS === 'android' ? colors.primary : undefined
|
|
20
|
+
}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Slider };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { VariantProps, cva } from 'class-variance-authority';
|
|
2
|
+
import { cssInterop } from 'nativewind';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { UITextView } from 'react-native-uitextview';
|
|
5
|
+
|
|
6
|
+
import { cn } from '~/lib/cn';
|
|
7
|
+
|
|
8
|
+
cssInterop(UITextView, { className: 'style' });
|
|
9
|
+
|
|
10
|
+
const textVariants = cva('text-foreground', {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
largeTitle: 'text-4xl',
|
|
14
|
+
title1: 'text-2xl',
|
|
15
|
+
title2: 'text-[22px] leading-7',
|
|
16
|
+
title3: 'text-xl',
|
|
17
|
+
heading: 'text-[17px] leading-6 font-semibold',
|
|
18
|
+
body: 'text-[17px] leading-6',
|
|
19
|
+
callout: 'text-base',
|
|
20
|
+
subhead: 'text-[15px] leading-6',
|
|
21
|
+
footnote: 'text-[13px] leading-5',
|
|
22
|
+
caption1: 'text-xs',
|
|
23
|
+
caption2: 'text-[11px] leading-4',
|
|
24
|
+
},
|
|
25
|
+
color: {
|
|
26
|
+
primary: '',
|
|
27
|
+
secondary: 'text-secondary-foreground/90',
|
|
28
|
+
tertiary: 'text-muted-foreground/90',
|
|
29
|
+
quarternary: 'text-muted-foreground/50',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: 'body',
|
|
34
|
+
color: 'primary',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const TextClassContext = React.createContext<string | undefined>(undefined);
|
|
39
|
+
|
|
40
|
+
function Text({
|
|
41
|
+
className,
|
|
42
|
+
variant,
|
|
43
|
+
color,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentPropsWithoutRef<typeof UITextView> & VariantProps<typeof textVariants>) {
|
|
46
|
+
const textClassName = React.useContext(TextClassContext);
|
|
47
|
+
return (
|
|
48
|
+
<UITextView
|
|
49
|
+
className={cn(textVariants({ variant, color }), textClassName, className)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { Text, TextClassContext, textVariants };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Switch } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { useColorScheme } from '~/lib/useColorScheme';
|
|
4
|
+
import { COLORS } from '~/theme/colors';
|
|
5
|
+
|
|
6
|
+
function Toggle(props: React.ComponentPropsWithoutRef<typeof Switch>) {
|
|
7
|
+
const { colors } = useColorScheme();
|
|
8
|
+
return (
|
|
9
|
+
<Switch
|
|
10
|
+
trackColor={{
|
|
11
|
+
true: colors.primary,
|
|
12
|
+
false: colors.grey,
|
|
13
|
+
}}
|
|
14
|
+
thumbColor={COLORS.white}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Toggle };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Learn more https://docs.expo.io/guides/customizing-metro
|
|
2
|
+
const { getDefaultConfig } = require("expo/metro-config");
|
|
3
|
+
|
|
4
|
+
const { withNativeWind } = require("nativewind/metro");
|
|
5
|
+
|
|
6
|
+
/** @type {import('expo/metro-config').MetroConfig} */
|
|
7
|
+
// eslint-disable-next-line no-undef
|
|
8
|
+
const config = getDefaultConfig(__dirname);
|
|
9
|
+
|
|
10
|
+
module.exports = withNativeWind(config, { input: "./global.css" });
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "test-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "expo-router/entry",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"android": "expo start --android",
|
|
7
|
+
"ios": "expo start --ios",
|
|
8
|
+
"start": "expo start",
|
|
9
|
+
"prebuild": "expo prebuild",
|
|
10
|
+
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\" && prettier -c \"**/*.{js,jsx,ts,tsx,json}\"",
|
|
11
|
+
"format": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix && prettier \"**/*.{js,jsx,ts,tsx,json}\" --write",
|
|
12
|
+
"web": "expo start --web"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@expo/react-native-action-sheet": "^4.1.0",
|
|
16
|
+
"@expo/vector-icons": "^14.0.0",
|
|
17
|
+
"@gorhom/bottom-sheet": "^4.6.4",
|
|
18
|
+
"@react-native-community/datetimepicker": "8.0.1",
|
|
19
|
+
"@react-native-community/slider": "4.5.2",
|
|
20
|
+
"@react-native-picker/picker": "2.7.5",
|
|
21
|
+
"@react-navigation/native": "^6.1.7",
|
|
22
|
+
"expo": "^51.0.0",
|
|
23
|
+
"expo-constants": "~16.0.1",
|
|
24
|
+
"expo-linking": "~6.3.1",
|
|
25
|
+
"expo-router": "~3.5.14",
|
|
26
|
+
"expo-status-bar": "~1.12.1",
|
|
27
|
+
"expo-store-review": "~7.0.2",
|
|
28
|
+
"expo-system-ui": "~3.0.4",
|
|
29
|
+
"expo-web-browser": "~13.0.3",
|
|
30
|
+
"nativewind": "^4.0.1",
|
|
31
|
+
"react": "18.2.0",
|
|
32
|
+
"react-dom": "18.2.0",
|
|
33
|
+
"react-native": "0.74.1",
|
|
34
|
+
"react-native-gesture-handler": "~2.16.1",
|
|
35
|
+
"react-native-reanimated": "~3.10.1",
|
|
36
|
+
"react-native-safe-area-context": "4.10.1",
|
|
37
|
+
"react-native-screens": "3.31.1",
|
|
38
|
+
"react-native-web": "~0.19.10"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@babel/core": "^7.20.0",
|
|
42
|
+
"@types/react": "~18.2.45",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
44
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
45
|
+
"eslint": "^8.57.0",
|
|
46
|
+
"eslint-config-universe": "^12.0.1",
|
|
47
|
+
"prettier": "^3.2.5",
|
|
48
|
+
"prettier-plugin-tailwindcss": "^0.5.11",
|
|
49
|
+
"tailwindcss": "^3.4.0",
|
|
50
|
+
"typescript": "~5.3.3"
|
|
51
|
+
},
|
|
52
|
+
"eslintConfig": {
|
|
53
|
+
"extends": "universe/native",
|
|
54
|
+
"root": true
|
|
55
|
+
},
|
|
56
|
+
"expo": {
|
|
57
|
+
"install": {
|
|
58
|
+
"exclude": [
|
|
59
|
+
"react-native-safe-area-context"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"private": true
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
content: [
|
|
4
|
+
"./index.{js,ts,tsx}",
|
|
5
|
+
"./app/**/*.{js,ts,tsx}",
|
|
6
|
+
"./components/**/*.{js,ts,tsx}",
|
|
7
|
+
],
|
|
8
|
+
|
|
9
|
+
presets: [require("nativewind/preset")],
|
|
10
|
+
theme: {
|
|
11
|
+
extend: {},
|
|
12
|
+
},
|
|
13
|
+
plugins: [],
|
|
14
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ScrollViewStyleReset } from "expo-router/html";
|
|
2
|
+
|
|
3
|
+
// This file is web-only and used to configure the root HTML for every
|
|
4
|
+
// web page during static rendering.
|
|
5
|
+
// The contents of this function only run in Node.js environments and
|
|
6
|
+
// do not have access to the DOM or browser APIs.
|
|
7
|
+
export default function Root({ children }: { children: React.ReactNode }) {
|
|
8
|
+
return (
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charSet="utf-8" />
|
|
12
|
+
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
|
|
13
|
+
|
|
14
|
+
{/*
|
|
15
|
+
This viewport disables scaling which makes the mobile website act more like a native app.
|
|
16
|
+
However this does reduce built-in accessibility. If you want to enable scaling, use this instead:
|
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
18
|
+
*/}
|
|
19
|
+
<meta
|
|
20
|
+
name="viewport"
|
|
21
|
+
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1.00001,viewport-fit=cover"
|
|
22
|
+
/>
|
|
23
|
+
{/*
|
|
24
|
+
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
|
|
25
|
+
However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
|
|
26
|
+
*/}
|
|
27
|
+
<ScrollViewStyleReset />
|
|
28
|
+
|
|
29
|
+
{/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
|
|
30
|
+
<style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
|
|
31
|
+
{/* Add any additional <head> elements that you want globally available on web... */}
|
|
32
|
+
</head>
|
|
33
|
+
<body>{children}</body>
|
|
34
|
+
</html>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const responsiveBackground = `
|
|
39
|
+
body {
|
|
40
|
+
background-color: #fff;
|
|
41
|
+
}
|
|
42
|
+
@media (prefers-color-scheme: dark) {
|
|
43
|
+
body {
|
|
44
|
+
background-color: #000;
|
|
45
|
+
}
|
|
46
|
+
}`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Link, Stack } from "expo-router";
|
|
2
|
+
|
|
3
|
+
import { Text } from "react-native";
|
|
4
|
+
|
|
5
|
+
import { Container } from "~/components/Container";
|
|
6
|
+
|
|
7
|
+
export default function NotFoundScreen() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<Stack.Screen options={{ title: "Oops!" }} />
|
|
11
|
+
<Container>
|
|
12
|
+
<Text className={styles.title}>This screen doesn't exist.</Text>
|
|
13
|
+
<Link href="/" className={styles.link}>
|
|
14
|
+
<Text className={styles.linkText}>Go to home screen!</Text>
|
|
15
|
+
</Link>
|
|
16
|
+
</Container>
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const styles = {
|
|
22
|
+
title: `text-xl font-bold`,
|
|
23
|
+
link: `mt-4 pt-4`,
|
|
24
|
+
linkText: `text-base text-[#2e78b7]`,
|
|
25
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Stack, useLocalSearchParams } from "expo-router";
|
|
2
|
+
|
|
3
|
+
import { Container } from "~/components/Container";
|
|
4
|
+
import { ScreenContent } from "~/components/ScreenContent";
|
|
5
|
+
|
|
6
|
+
export default function Details() {
|
|
7
|
+
const { name } = useLocalSearchParams();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<Stack.Screen options={{ title: "Details" }} />
|
|
12
|
+
<Container>
|
|
13
|
+
<ScreenContent
|
|
14
|
+
path="screens/details.tsx"
|
|
15
|
+
title={`Showing details for user ${name}`}
|
|
16
|
+
/>
|
|
17
|
+
</Container>
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Stack, Link } from "expo-router";
|
|
2
|
+
|
|
3
|
+
import { Button } from "~/components/Button";
|
|
4
|
+
import { Container } from "~/components/Container";
|
|
5
|
+
import { ScreenContent } from "~/components/ScreenContent";
|
|
6
|
+
|
|
7
|
+
export default function Home() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<Stack.Screen options={{ title: "Home" }} />
|
|
11
|
+
<Container>
|
|
12
|
+
<ScreenContent path="app/index.tsx" title="Home"></ScreenContent>
|
|
13
|
+
<Link href={{ pathname: "/details", params: { name: "Dan" } }} asChild>
|
|
14
|
+
<Button title="Show Details" />
|
|
15
|
+
</Link>
|
|
16
|
+
</Container>
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"expo": {
|
|
3
|
+
"name": "test-no-install",
|
|
4
|
+
"slug": "test-no-install",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
|
|
7
|
+
"scheme": "test-no-install",
|
|
8
|
+
"web": {
|
|
9
|
+
"bundler": "metro",
|
|
10
|
+
"output": "static",
|
|
11
|
+
"favicon": "./assets/favicon.png"
|
|
12
|
+
},
|
|
13
|
+
"plugins": ["expo-router"],
|
|
14
|
+
"experiments": {
|
|
15
|
+
"typedRoutes": true,
|
|
16
|
+
|
|
17
|
+
"tsconfigPaths": true
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"orientation": "portrait",
|
|
21
|
+
"icon": "./assets/icon.png",
|
|
22
|
+
|
|
23
|
+
"userInterfaceStyle": "light",
|
|
24
|
+
|
|
25
|
+
"splash": {
|
|
26
|
+
"image": "./assets/splash.png",
|
|
27
|
+
"resizeMode": "contain",
|
|
28
|
+
"backgroundColor": "#ffffff"
|
|
29
|
+
},
|
|
30
|
+
"assetBundlePatterns": ["**/*"],
|
|
31
|
+
"ios": {
|
|
32
|
+
"supportsTablet": true
|
|
33
|
+
},
|
|
34
|
+
"android": {
|
|
35
|
+
"adaptiveIcon": {
|
|
36
|
+
"foregroundImage": "./assets/adaptive-icon.png",
|
|
37
|
+
"backgroundColor": "#ffffff"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cesVersion": "2.11.17",
|
|
3
|
+
"projectName": "test-no-install",
|
|
4
|
+
"packages": [
|
|
5
|
+
{
|
|
6
|
+
"name": "expo-router",
|
|
7
|
+
"type": "navigation",
|
|
8
|
+
"options": {
|
|
9
|
+
"type": "stack"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "nativewind",
|
|
14
|
+
"type": "styling"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"flags": {
|
|
18
|
+
"noGit": false,
|
|
19
|
+
"noInstall": true,
|
|
20
|
+
"overwrite": false,
|
|
21
|
+
"importAlias": true,
|
|
22
|
+
"packageManager": "npm",
|
|
23
|
+
"eas": false
|
|
24
|
+
},
|
|
25
|
+
"packageManager": {
|
|
26
|
+
"type": "npm",
|
|
27
|
+
"version": "10.5.0"
|
|
28
|
+
},
|
|
29
|
+
"os": {
|
|
30
|
+
"type": "Darwin",
|
|
31
|
+
"platform": "darwin",
|
|
32
|
+
"arch": "arm64",
|
|
33
|
+
"kernelVersion": "23.3.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { Text, TouchableOpacity, TouchableOpacityProps } from "react-native";
|
|
3
|
+
|
|
4
|
+
type ButtonProps = {
|
|
5
|
+
title: string;
|
|
6
|
+
} & TouchableOpacityProps;
|
|
7
|
+
|
|
8
|
+
export const Button = forwardRef<TouchableOpacity, ButtonProps>(
|
|
9
|
+
({ title, ...touchableProps }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<TouchableOpacity
|
|
12
|
+
ref={ref}
|
|
13
|
+
{...touchableProps}
|
|
14
|
+
className={`${styles.button} ${touchableProps.className}`}
|
|
15
|
+
>
|
|
16
|
+
<Text className={styles.buttonText}>{title}</Text>
|
|
17
|
+
</TouchableOpacity>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const styles = {
|
|
23
|
+
button: "items-center bg-indigo-500 rounded-[28px] shadow-md p-4",
|
|
24
|
+
buttonText: "text-white text-lg font-semibold text-center",
|
|
25
|
+
};
|