beautiful-snackbar 1.0.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 +233 -0
- package/example/.claude/settings.json +5 -0
- package/example/.vscode/extensions.json +1 -0
- package/example/.vscode/settings.json +7 -0
- package/example/AGENTS.md +3 -0
- package/example/CLAUDE.md +1 -0
- package/example/app.json +44 -0
- package/example/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
- package/example/assets/expo.icon/Assets/grid.png +0 -0
- package/example/assets/expo.icon/icon.json +40 -0
- package/example/assets/images/android-icon-background.png +0 -0
- package/example/assets/images/android-icon-foreground.png +0 -0
- package/example/assets/images/android-icon-monochrome.png +0 -0
- package/example/assets/images/expo-badge-white.png +0 -0
- package/example/assets/images/expo-badge.png +0 -0
- package/example/assets/images/expo-logo.png +0 -0
- package/example/assets/images/favicon.png +0 -0
- package/example/assets/images/icon.png +0 -0
- package/example/assets/images/logo-glow.png +0 -0
- package/example/assets/images/react-logo.png +0 -0
- package/example/assets/images/react-logo@2x.png +0 -0
- package/example/assets/images/react-logo@3x.png +0 -0
- package/example/assets/images/splash-icon.png +0 -0
- package/example/assets/images/tabIcons/explore.png +0 -0
- package/example/assets/images/tabIcons/explore@2x.png +0 -0
- package/example/assets/images/tabIcons/explore@3x.png +0 -0
- package/example/assets/images/tabIcons/home.png +0 -0
- package/example/assets/images/tabIcons/home@2x.png +0 -0
- package/example/assets/images/tabIcons/home@3x.png +0 -0
- package/example/assets/images/tutorial-web.png +0 -0
- package/example/metro.config.js +24 -0
- package/example/package.json +46 -0
- package/example/scripts/reset-project.js +114 -0
- package/example/src/app/_layout.tsx +63 -0
- package/example/src/app/explore.tsx +181 -0
- package/example/src/app/index.tsx +641 -0
- package/example/src/components/animated-icon.module.css +6 -0
- package/example/src/components/animated-icon.tsx +132 -0
- package/example/src/components/animated-icon.web.tsx +108 -0
- package/example/src/components/app-tabs.tsx +33 -0
- package/example/src/components/app-tabs.web.tsx +116 -0
- package/example/src/components/external-link.tsx +25 -0
- package/example/src/components/hint-row.tsx +35 -0
- package/example/src/components/themed-text.tsx +73 -0
- package/example/src/components/themed-view.tsx +16 -0
- package/example/src/components/ui/collapsible.tsx +65 -0
- package/example/src/components/web-badge.tsx +44 -0
- package/example/src/constants/theme.ts +66 -0
- package/example/src/global.css +9 -0
- package/example/src/hooks/use-color-scheme.ts +1 -0
- package/example/src/hooks/use-color-scheme.web.ts +21 -0
- package/example/src/hooks/use-theme.ts +14 -0
- package/example/tsconfig.json +35 -0
- package/lib/components/ActionableSnackbar.d.ts +7 -0
- package/lib/components/ActionableSnackbar.js +96 -0
- package/lib/components/BeautifulSnackbar.d.ts +11 -0
- package/lib/components/BeautifulSnackbar.js +189 -0
- package/lib/components/StandardSnackbar.d.ts +7 -0
- package/lib/components/StandardSnackbar.js +65 -0
- package/lib/constants.d.ts +7 -0
- package/lib/constants.js +20 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +11 -0
- package/lib/manager.d.ts +58 -0
- package/lib/manager.js +107 -0
- package/lib/types.d.ts +25 -0
- package/lib/types.js +2 -0
- package/lib/useSnackbarAnimation.d.ts +14 -0
- package/lib/useSnackbarAnimation.js +118 -0
- package/package.json +33 -0
- package/src/components/ActionableSnackbar.tsx +109 -0
- package/src/components/BeautifulSnackbar.tsx +203 -0
- package/src/components/StandardSnackbar.tsx +70 -0
- package/src/constants.ts +20 -0
- package/src/index.ts +5 -0
- package/src/manager.ts +151 -0
- package/src/types.ts +27 -0
- package/src/useSnackbarAnimation.ts +145 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Image } from 'expo-image';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
4
|
+
import Animated, { Easing, Keyframe } from 'react-native-reanimated';
|
|
5
|
+
import { scheduleOnRN } from 'react-native-worklets';
|
|
6
|
+
|
|
7
|
+
const INITIAL_SCALE_FACTOR = Dimensions.get('screen').height / 90;
|
|
8
|
+
const DURATION = 600;
|
|
9
|
+
|
|
10
|
+
export function AnimatedSplashOverlay() {
|
|
11
|
+
const [visible, setVisible] = useState(true);
|
|
12
|
+
|
|
13
|
+
if (!visible) return null;
|
|
14
|
+
|
|
15
|
+
const splashKeyframe = new Keyframe({
|
|
16
|
+
0: {
|
|
17
|
+
transform: [{ scale: INITIAL_SCALE_FACTOR }],
|
|
18
|
+
opacity: 1,
|
|
19
|
+
},
|
|
20
|
+
20: {
|
|
21
|
+
opacity: 1,
|
|
22
|
+
},
|
|
23
|
+
70: {
|
|
24
|
+
opacity: 0,
|
|
25
|
+
easing: Easing.elastic(0.7),
|
|
26
|
+
},
|
|
27
|
+
100: {
|
|
28
|
+
opacity: 0,
|
|
29
|
+
transform: [{ scale: 1 }],
|
|
30
|
+
easing: Easing.elastic(0.7),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Animated.View
|
|
36
|
+
entering={splashKeyframe.duration(DURATION).withCallback((finished) => {
|
|
37
|
+
'worklet';
|
|
38
|
+
if (finished) {
|
|
39
|
+
scheduleOnRN(setVisible, false);
|
|
40
|
+
}
|
|
41
|
+
})}
|
|
42
|
+
style={styles.backgroundSolidColor}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const keyframe = new Keyframe({
|
|
48
|
+
0: {
|
|
49
|
+
transform: [{ scale: INITIAL_SCALE_FACTOR }],
|
|
50
|
+
},
|
|
51
|
+
100: {
|
|
52
|
+
transform: [{ scale: 1 }],
|
|
53
|
+
easing: Easing.elastic(0.7),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const logoKeyframe = new Keyframe({
|
|
58
|
+
0: {
|
|
59
|
+
transform: [{ scale: 1.3 }],
|
|
60
|
+
opacity: 0,
|
|
61
|
+
},
|
|
62
|
+
40: {
|
|
63
|
+
transform: [{ scale: 1.3 }],
|
|
64
|
+
opacity: 0,
|
|
65
|
+
easing: Easing.elastic(0.7),
|
|
66
|
+
},
|
|
67
|
+
100: {
|
|
68
|
+
opacity: 1,
|
|
69
|
+
transform: [{ scale: 1 }],
|
|
70
|
+
easing: Easing.elastic(0.7),
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const glowKeyframe = new Keyframe({
|
|
75
|
+
0: {
|
|
76
|
+
transform: [{ rotateZ: '0deg' }],
|
|
77
|
+
},
|
|
78
|
+
100: {
|
|
79
|
+
transform: [{ rotateZ: '7200deg' }],
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export function AnimatedIcon() {
|
|
84
|
+
return (
|
|
85
|
+
<View style={styles.iconContainer}>
|
|
86
|
+
<Animated.View entering={glowKeyframe.duration(60 * 1000 * 4)} style={styles.glow}>
|
|
87
|
+
<Image style={styles.glow} source={require('@/assets/images/logo-glow.png')} />
|
|
88
|
+
</Animated.View>
|
|
89
|
+
|
|
90
|
+
<Animated.View entering={keyframe.duration(DURATION)} style={styles.background} />
|
|
91
|
+
<Animated.View style={styles.imageContainer} entering={logoKeyframe.duration(DURATION)}>
|
|
92
|
+
<Image style={styles.image} source={require('@/assets/images/expo-logo.png')} />
|
|
93
|
+
</Animated.View>
|
|
94
|
+
</View>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const styles = StyleSheet.create({
|
|
99
|
+
imageContainer: {
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
alignItems: 'center',
|
|
102
|
+
},
|
|
103
|
+
glow: {
|
|
104
|
+
width: 201,
|
|
105
|
+
height: 201,
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
},
|
|
108
|
+
iconContainer: {
|
|
109
|
+
justifyContent: 'center',
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
width: 128,
|
|
112
|
+
height: 128,
|
|
113
|
+
zIndex: 100,
|
|
114
|
+
},
|
|
115
|
+
image: {
|
|
116
|
+
position: 'absolute',
|
|
117
|
+
width: 76,
|
|
118
|
+
height: 71,
|
|
119
|
+
},
|
|
120
|
+
background: {
|
|
121
|
+
borderRadius: 40,
|
|
122
|
+
experimental_backgroundImage: `linear-gradient(180deg, #3C9FFE, #0274DF)`,
|
|
123
|
+
width: 128,
|
|
124
|
+
height: 128,
|
|
125
|
+
position: 'absolute',
|
|
126
|
+
},
|
|
127
|
+
backgroundSolidColor: {
|
|
128
|
+
...StyleSheet.absoluteFillObject,
|
|
129
|
+
backgroundColor: '#208AEF',
|
|
130
|
+
zIndex: 1000,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Image } from 'expo-image';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import Animated, { Keyframe, Easing } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
import classes from './animated-icon.module.css';
|
|
6
|
+
const DURATION = 300;
|
|
7
|
+
|
|
8
|
+
export function AnimatedSplashOverlay() {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const keyframe = new Keyframe({
|
|
13
|
+
0: {
|
|
14
|
+
transform: [{ scale: 0 }],
|
|
15
|
+
},
|
|
16
|
+
60: {
|
|
17
|
+
transform: [{ scale: 1.2 }],
|
|
18
|
+
easing: Easing.elastic(1.2),
|
|
19
|
+
},
|
|
20
|
+
100: {
|
|
21
|
+
transform: [{ scale: 1 }],
|
|
22
|
+
easing: Easing.elastic(1.2),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const logoKeyframe = new Keyframe({
|
|
27
|
+
0: {
|
|
28
|
+
opacity: 0,
|
|
29
|
+
},
|
|
30
|
+
60: {
|
|
31
|
+
transform: [{ scale: 1.2 }],
|
|
32
|
+
opacity: 0,
|
|
33
|
+
easing: Easing.elastic(1.2),
|
|
34
|
+
},
|
|
35
|
+
100: {
|
|
36
|
+
transform: [{ scale: 1 }],
|
|
37
|
+
opacity: 1,
|
|
38
|
+
easing: Easing.elastic(1.2),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const glowKeyframe = new Keyframe({
|
|
43
|
+
0: {
|
|
44
|
+
transform: [{ rotateZ: '-180deg' }, { scale: 0.8 }],
|
|
45
|
+
opacity: 0,
|
|
46
|
+
},
|
|
47
|
+
[DURATION / 1000]: {
|
|
48
|
+
transform: [{ rotateZ: '0deg' }, { scale: 1 }],
|
|
49
|
+
opacity: 1,
|
|
50
|
+
easing: Easing.elastic(0.7),
|
|
51
|
+
},
|
|
52
|
+
100: {
|
|
53
|
+
transform: [{ rotateZ: '7200deg' }],
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export function AnimatedIcon() {
|
|
58
|
+
return (
|
|
59
|
+
<View style={styles.iconContainer}>
|
|
60
|
+
<Animated.View entering={glowKeyframe.duration(60 * 1000 * 4)} style={styles.glow}>
|
|
61
|
+
<Image style={styles.glow} source={require('@/assets/images/logo-glow.png')} />
|
|
62
|
+
</Animated.View>
|
|
63
|
+
|
|
64
|
+
<Animated.View style={styles.background} entering={keyframe.duration(DURATION)}>
|
|
65
|
+
<div className={classes.expoLogoBackground} />
|
|
66
|
+
</Animated.View>
|
|
67
|
+
|
|
68
|
+
<Animated.View style={styles.imageContainer} entering={logoKeyframe.duration(DURATION)}>
|
|
69
|
+
<Image style={styles.image} source={require('@/assets/images/expo-logo.png')} />
|
|
70
|
+
</Animated.View>
|
|
71
|
+
</View>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const styles = StyleSheet.create({
|
|
76
|
+
container: {
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
width: '100%',
|
|
79
|
+
zIndex: 1000,
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
top: 128 / 2 + 138,
|
|
82
|
+
},
|
|
83
|
+
imageContainer: {
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
},
|
|
87
|
+
glow: {
|
|
88
|
+
width: 201,
|
|
89
|
+
height: 201,
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
},
|
|
92
|
+
iconContainer: {
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
width: 128,
|
|
96
|
+
height: 128,
|
|
97
|
+
},
|
|
98
|
+
image: {
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
width: 76,
|
|
101
|
+
height: 71,
|
|
102
|
+
},
|
|
103
|
+
background: {
|
|
104
|
+
width: 128,
|
|
105
|
+
height: 128,
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
},
|
|
108
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NativeTabs } from 'expo-router/unstable-native-tabs';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useColorScheme } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { Colors } from '@/constants/theme';
|
|
6
|
+
|
|
7
|
+
export default function AppTabs() {
|
|
8
|
+
const scheme = useColorScheme();
|
|
9
|
+
const colors = Colors[scheme === 'unspecified' ? 'light' : scheme];
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<NativeTabs
|
|
13
|
+
backgroundColor={colors.background}
|
|
14
|
+
indicatorColor={colors.backgroundElement}
|
|
15
|
+
labelStyle={{ selected: { color: colors.text } }}>
|
|
16
|
+
<NativeTabs.Trigger name="index">
|
|
17
|
+
<NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>
|
|
18
|
+
<NativeTabs.Trigger.Icon
|
|
19
|
+
src={require('@/assets/images/tabIcons/home.png')}
|
|
20
|
+
renderingMode="template"
|
|
21
|
+
/>
|
|
22
|
+
</NativeTabs.Trigger>
|
|
23
|
+
|
|
24
|
+
<NativeTabs.Trigger name="explore">
|
|
25
|
+
<NativeTabs.Trigger.Label>Explore</NativeTabs.Trigger.Label>
|
|
26
|
+
<NativeTabs.Trigger.Icon
|
|
27
|
+
src={require('@/assets/images/tabIcons/explore.png')}
|
|
28
|
+
renderingMode="template"
|
|
29
|
+
/>
|
|
30
|
+
</NativeTabs.Trigger>
|
|
31
|
+
</NativeTabs>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Tabs,
|
|
3
|
+
TabList,
|
|
4
|
+
TabTrigger,
|
|
5
|
+
TabSlot,
|
|
6
|
+
TabTriggerSlotProps,
|
|
7
|
+
TabListProps,
|
|
8
|
+
} from 'expo-router/ui';
|
|
9
|
+
import { SymbolView } from 'expo-symbols';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { Pressable, useColorScheme, View, StyleSheet } from 'react-native';
|
|
12
|
+
|
|
13
|
+
import { ExternalLink } from './external-link';
|
|
14
|
+
import { ThemedText } from './themed-text';
|
|
15
|
+
import { ThemedView } from './themed-view';
|
|
16
|
+
|
|
17
|
+
import { Colors, MaxContentWidth, Spacing } from '@/constants/theme';
|
|
18
|
+
|
|
19
|
+
export default function AppTabs() {
|
|
20
|
+
return (
|
|
21
|
+
<Tabs>
|
|
22
|
+
<TabSlot style={{ height: '100%' }} />
|
|
23
|
+
<TabList asChild>
|
|
24
|
+
<CustomTabList>
|
|
25
|
+
<TabTrigger name="home" href="/" asChild>
|
|
26
|
+
<TabButton>Home</TabButton>
|
|
27
|
+
</TabTrigger>
|
|
28
|
+
<TabTrigger name="explore" href="/explore" asChild>
|
|
29
|
+
<TabButton>Explore</TabButton>
|
|
30
|
+
</TabTrigger>
|
|
31
|
+
</CustomTabList>
|
|
32
|
+
</TabList>
|
|
33
|
+
</Tabs>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function TabButton({ children, isFocused, ...props }: TabTriggerSlotProps) {
|
|
38
|
+
return (
|
|
39
|
+
<Pressable {...props} style={({ pressed }) => pressed && styles.pressed}>
|
|
40
|
+
<ThemedView
|
|
41
|
+
type={isFocused ? 'backgroundSelected' : 'backgroundElement'}
|
|
42
|
+
style={styles.tabButtonView}>
|
|
43
|
+
<ThemedText type="small" themeColor={isFocused ? 'text' : 'textSecondary'}>
|
|
44
|
+
{children}
|
|
45
|
+
</ThemedText>
|
|
46
|
+
</ThemedView>
|
|
47
|
+
</Pressable>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function CustomTabList(props: TabListProps) {
|
|
52
|
+
const scheme = useColorScheme();
|
|
53
|
+
const colors = Colors[scheme === 'unspecified' ? 'light' : scheme];
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<View {...props} style={styles.tabListContainer}>
|
|
57
|
+
<ThemedView type="backgroundElement" style={styles.innerContainer}>
|
|
58
|
+
<ThemedText type="smallBold" style={styles.brandText}>
|
|
59
|
+
Expo Starter
|
|
60
|
+
</ThemedText>
|
|
61
|
+
|
|
62
|
+
{props.children}
|
|
63
|
+
|
|
64
|
+
<ExternalLink href="https://docs.expo.dev" asChild>
|
|
65
|
+
<Pressable style={styles.externalPressable}>
|
|
66
|
+
<ThemedText type="link">Docs</ThemedText>
|
|
67
|
+
<SymbolView
|
|
68
|
+
tintColor={colors.text}
|
|
69
|
+
name={{ ios: 'arrow.up.right.square', web: 'link' }}
|
|
70
|
+
size={12}
|
|
71
|
+
/>
|
|
72
|
+
</Pressable>
|
|
73
|
+
</ExternalLink>
|
|
74
|
+
</ThemedView>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
tabListContainer: {
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
width: '100%',
|
|
83
|
+
padding: Spacing.three,
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
flexDirection: 'row',
|
|
87
|
+
},
|
|
88
|
+
innerContainer: {
|
|
89
|
+
paddingVertical: Spacing.two,
|
|
90
|
+
paddingHorizontal: Spacing.five,
|
|
91
|
+
borderRadius: Spacing.five,
|
|
92
|
+
flexDirection: 'row',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
flexGrow: 1,
|
|
95
|
+
gap: Spacing.two,
|
|
96
|
+
maxWidth: MaxContentWidth,
|
|
97
|
+
},
|
|
98
|
+
brandText: {
|
|
99
|
+
marginRight: 'auto',
|
|
100
|
+
},
|
|
101
|
+
pressed: {
|
|
102
|
+
opacity: 0.7,
|
|
103
|
+
},
|
|
104
|
+
tabButtonView: {
|
|
105
|
+
paddingVertical: Spacing.one,
|
|
106
|
+
paddingHorizontal: Spacing.three,
|
|
107
|
+
borderRadius: Spacing.three,
|
|
108
|
+
},
|
|
109
|
+
externalPressable: {
|
|
110
|
+
flexDirection: 'row',
|
|
111
|
+
justifyContent: 'center',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
gap: Spacing.one,
|
|
114
|
+
marginLeft: Spacing.three,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Href, Link } from 'expo-router';
|
|
2
|
+
import { openBrowserAsync, WebBrowserPresentationStyle } from 'expo-web-browser';
|
|
3
|
+
import { type ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type Props = Omit<ComponentProps<typeof Link>, 'href'> & { href: Href & string };
|
|
6
|
+
|
|
7
|
+
export function ExternalLink({ href, ...rest }: Props) {
|
|
8
|
+
return (
|
|
9
|
+
<Link
|
|
10
|
+
target="_blank"
|
|
11
|
+
{...rest}
|
|
12
|
+
href={href}
|
|
13
|
+
onPress={async (event) => {
|
|
14
|
+
if (process.env.EXPO_OS !== 'web') {
|
|
15
|
+
// Prevent the default behavior of linking to the default browser on native.
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
// Open the link in an in-app browser.
|
|
18
|
+
await openBrowserAsync(href, {
|
|
19
|
+
presentationStyle: WebBrowserPresentationStyle.AUTOMATIC,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { ThemedText } from './themed-text';
|
|
5
|
+
import { ThemedView } from './themed-view';
|
|
6
|
+
|
|
7
|
+
import { Spacing } from '@/constants/theme';
|
|
8
|
+
|
|
9
|
+
type HintRowProps = {
|
|
10
|
+
title?: string;
|
|
11
|
+
hint?: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function HintRow({ title = 'Try editing', hint = 'app/index.tsx' }: HintRowProps) {
|
|
15
|
+
return (
|
|
16
|
+
<View style={styles.stepRow}>
|
|
17
|
+
<ThemedText type="small">{title}</ThemedText>
|
|
18
|
+
<ThemedView type="backgroundSelected" style={styles.codeSnippet}>
|
|
19
|
+
<ThemedText themeColor="textSecondary">{hint}</ThemedText>
|
|
20
|
+
</ThemedView>
|
|
21
|
+
</View>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const styles = StyleSheet.create({
|
|
26
|
+
stepRow: {
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
justifyContent: 'space-between',
|
|
29
|
+
},
|
|
30
|
+
codeSnippet: {
|
|
31
|
+
borderRadius: Spacing.two,
|
|
32
|
+
paddingVertical: Spacing.half,
|
|
33
|
+
paddingHorizontal: Spacing.two,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Platform, StyleSheet, Text, type TextProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { Fonts, ThemeColor } from '@/constants/theme';
|
|
4
|
+
import { useTheme } from '@/hooks/use-theme';
|
|
5
|
+
|
|
6
|
+
export type ThemedTextProps = TextProps & {
|
|
7
|
+
type?: 'default' | 'title' | 'small' | 'smallBold' | 'subtitle' | 'link' | 'linkPrimary' | 'code';
|
|
8
|
+
themeColor?: ThemeColor;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function ThemedText({ style, type = 'default', themeColor, ...rest }: ThemedTextProps) {
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Text
|
|
16
|
+
style={[
|
|
17
|
+
{ color: theme[themeColor ?? 'text'] },
|
|
18
|
+
type === 'default' && styles.default,
|
|
19
|
+
type === 'title' && styles.title,
|
|
20
|
+
type === 'small' && styles.small,
|
|
21
|
+
type === 'smallBold' && styles.smallBold,
|
|
22
|
+
type === 'subtitle' && styles.subtitle,
|
|
23
|
+
type === 'link' && styles.link,
|
|
24
|
+
type === 'linkPrimary' && styles.linkPrimary,
|
|
25
|
+
type === 'code' && styles.code,
|
|
26
|
+
style,
|
|
27
|
+
]}
|
|
28
|
+
{...rest}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
small: {
|
|
35
|
+
fontSize: 14,
|
|
36
|
+
lineHeight: 20,
|
|
37
|
+
fontWeight: 500,
|
|
38
|
+
},
|
|
39
|
+
smallBold: {
|
|
40
|
+
fontSize: 14,
|
|
41
|
+
lineHeight: 20,
|
|
42
|
+
fontWeight: 700,
|
|
43
|
+
},
|
|
44
|
+
default: {
|
|
45
|
+
fontSize: 16,
|
|
46
|
+
lineHeight: 24,
|
|
47
|
+
fontWeight: 500,
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
fontSize: 48,
|
|
51
|
+
fontWeight: 600,
|
|
52
|
+
lineHeight: 52,
|
|
53
|
+
},
|
|
54
|
+
subtitle: {
|
|
55
|
+
fontSize: 32,
|
|
56
|
+
lineHeight: 44,
|
|
57
|
+
fontWeight: 600,
|
|
58
|
+
},
|
|
59
|
+
link: {
|
|
60
|
+
lineHeight: 30,
|
|
61
|
+
fontSize: 14,
|
|
62
|
+
},
|
|
63
|
+
linkPrimary: {
|
|
64
|
+
lineHeight: 30,
|
|
65
|
+
fontSize: 14,
|
|
66
|
+
color: '#3c87f7',
|
|
67
|
+
},
|
|
68
|
+
code: {
|
|
69
|
+
fontFamily: Fonts.mono,
|
|
70
|
+
fontWeight: Platform.select({ android: 700 }) ?? 500,
|
|
71
|
+
fontSize: 12,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { View, type ViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { ThemeColor } from '@/constants/theme';
|
|
4
|
+
import { useTheme } from '@/hooks/use-theme';
|
|
5
|
+
|
|
6
|
+
export type ThemedViewProps = ViewProps & {
|
|
7
|
+
lightColor?: string;
|
|
8
|
+
darkColor?: string;
|
|
9
|
+
type?: ThemeColor;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function ThemedView({ style, lightColor, darkColor, type, ...otherProps }: ThemedViewProps) {
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
|
|
15
|
+
return <View style={[{ backgroundColor: theme[type ?? 'background'] }, style]} {...otherProps} />;
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SymbolView } from 'expo-symbols';
|
|
2
|
+
import { PropsWithChildren, useState } from 'react';
|
|
3
|
+
import { Pressable, StyleSheet } from 'react-native';
|
|
4
|
+
import Animated, { FadeIn } from 'react-native-reanimated';
|
|
5
|
+
|
|
6
|
+
import { ThemedText } from '@/components/themed-text';
|
|
7
|
+
import { ThemedView } from '@/components/themed-view';
|
|
8
|
+
import { Spacing } from '@/constants/theme';
|
|
9
|
+
import { useTheme } from '@/hooks/use-theme';
|
|
10
|
+
|
|
11
|
+
export function Collapsible({ children, title }: PropsWithChildren & { title: string }) {
|
|
12
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<ThemedView>
|
|
17
|
+
<Pressable
|
|
18
|
+
style={({ pressed }) => [styles.heading, pressed && styles.pressedHeading]}
|
|
19
|
+
onPress={() => setIsOpen((value) => !value)}>
|
|
20
|
+
<ThemedView type="backgroundElement" style={styles.button}>
|
|
21
|
+
<SymbolView
|
|
22
|
+
name={{ ios: 'chevron.right', android: 'chevron_right', web: 'chevron_right' }}
|
|
23
|
+
size={14}
|
|
24
|
+
weight="bold"
|
|
25
|
+
tintColor={theme.text}
|
|
26
|
+
style={{ transform: [{ rotate: isOpen ? '-90deg' : '90deg' }] }}
|
|
27
|
+
/>
|
|
28
|
+
</ThemedView>
|
|
29
|
+
|
|
30
|
+
<ThemedText type="small">{title}</ThemedText>
|
|
31
|
+
</Pressable>
|
|
32
|
+
{isOpen && (
|
|
33
|
+
<Animated.View entering={FadeIn.duration(200)}>
|
|
34
|
+
<ThemedView type="backgroundElement" style={styles.content}>
|
|
35
|
+
{children}
|
|
36
|
+
</ThemedView>
|
|
37
|
+
</Animated.View>
|
|
38
|
+
)}
|
|
39
|
+
</ThemedView>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const styles = StyleSheet.create({
|
|
44
|
+
heading: {
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
gap: Spacing.two,
|
|
48
|
+
},
|
|
49
|
+
pressedHeading: {
|
|
50
|
+
opacity: 0.7,
|
|
51
|
+
},
|
|
52
|
+
button: {
|
|
53
|
+
width: Spacing.four,
|
|
54
|
+
height: Spacing.four,
|
|
55
|
+
borderRadius: 12,
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
},
|
|
59
|
+
content: {
|
|
60
|
+
marginTop: Spacing.three,
|
|
61
|
+
borderRadius: Spacing.three,
|
|
62
|
+
marginLeft: Spacing.four,
|
|
63
|
+
padding: Spacing.four,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { version } from 'expo/package.json';
|
|
2
|
+
import { Image } from 'expo-image';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useColorScheme, StyleSheet } from 'react-native';
|
|
5
|
+
|
|
6
|
+
import { ThemedText } from './themed-text';
|
|
7
|
+
import { ThemedView } from './themed-view';
|
|
8
|
+
|
|
9
|
+
import { Spacing } from '@/constants/theme';
|
|
10
|
+
|
|
11
|
+
export function WebBadge() {
|
|
12
|
+
const scheme = useColorScheme();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ThemedView style={styles.container}>
|
|
16
|
+
<ThemedText type="code" themeColor="textSecondary" style={styles.versionText}>
|
|
17
|
+
v{version}
|
|
18
|
+
</ThemedText>
|
|
19
|
+
<Image
|
|
20
|
+
source={
|
|
21
|
+
scheme === 'dark'
|
|
22
|
+
? require('@/assets/images/expo-badge-white.png')
|
|
23
|
+
: require('@/assets/images/expo-badge.png')
|
|
24
|
+
}
|
|
25
|
+
style={styles.badgeImage}
|
|
26
|
+
/>
|
|
27
|
+
</ThemedView>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
container: {
|
|
33
|
+
padding: Spacing.five,
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
gap: Spacing.two,
|
|
36
|
+
},
|
|
37
|
+
versionText: {
|
|
38
|
+
textAlign: 'center',
|
|
39
|
+
},
|
|
40
|
+
badgeImage: {
|
|
41
|
+
width: 123,
|
|
42
|
+
aspectRatio: 123 / 24,
|
|
43
|
+
},
|
|
44
|
+
});
|