-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
132 lines (127 loc) · 3.42 KB
/
App.tsx
File metadata and controls
132 lines (127 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import {
StyleSheet,
Pressable,
Text,
View,
SafeAreaView,
Platform,
} from 'react-native';
import { TipKitInlineView, TipKitPopOverView } from 'react-native-tipkit';
import DonutIcon from './DonutIcon';
import Animated, { LinearTransition } from 'react-native-reanimated';
import { useCallback, useRef } from 'react';
export default function App() {
const topPlusButtonRef = useRef(null);
const bottomPlusButtonRef = useRef(null);
const onActionButtonPress = useCallback(() => {
console.log('Action button pressed');
}, []);
return (
<>
<SafeAreaView style={styles.safeAreaContainer}>
<View style={styles.titleContainer}>
<Animated.Text layout={LinearTransition} style={styles.title}>
TipKit Example
</Animated.Text>
<Pressable
ref={topPlusButtonRef}
style={styles.topButton}
onPress={() => console.log('Cool feature!')}
>
<Text style={styles.buttonText}>+</Text>
</Pressable>
</View>
<Animated.View layout={LinearTransition} style={styles.container}>
<TipKitInlineView
title="Set favorites"
description="Tap and hold a color to add it to your favorites"
tipContainerStyle={styles.inline}
/>
<View style={styles.buttonContainer}>
<Pressable
ref={bottomPlusButtonRef}
style={styles.bottomButton}
onPress={() => console.log('Cool feature!')}
>
<Text style={styles.buttonText}>+hello world+</Text>
</Pressable>
</View>
</Animated.View>
</SafeAreaView>
<TipKitPopOverView
targetRef={topPlusButtonRef}
title="Add New Color"
description="Tap here to add a new color to the list"
tipContainerStyle={styles.tipContainer}
icon={<DonutIcon height={40} width={40} />}
actionButtonOnPress={onActionButtonPress}
/>
<TipKitPopOverView
targetRef={bottomPlusButtonRef}
title="Add New Color"
description="Tap here to add a new color to the list"
tipContainerStyle={styles.tipContainer}
icon={<DonutIcon height={40} width={40} fill={'#66b2b2'} />}
actionButtonOnPress={onActionButtonPress}
actionButtonTitle="Learn more"
/>
</>
);
}
const styles = StyleSheet.create({
safeAreaContainer: {
flex: 1,
marginTop: Platform.select({ ios: 0, android: 24 }),
},
container: {
flex: 1,
gap: 12,
paddingHorizontal: 12,
paddingTop: 120,
},
titleContainer: {
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
paddingHorizontal: 24,
paddingTop: 16,
},
inline: {
backgroundColor: '#d7eef3',
},
tipContainer: {
backgroundColor: '#f1f4f2',
},
title: {
fontSize: 32,
fontWeight: 'bold',
textAlign: 'center',
color: '#333',
},
topButton: {
backgroundColor: '#66D210',
borderRadius: 100,
width: 50,
height: 50,
alignItems: 'center',
justifyContent: 'center',
},
bottomButton: {
backgroundColor: '#66D210',
borderRadius: 100,
height: 50,
width: 200,
alignItems: 'center',
justifyContent: 'center',
left: 50,
},
buttonText: {
color: '#333',
},
buttonContainer: {
width: '100%',
alignSelf: 'center',
position: 'absolute',
bottom: 24,
},
});