-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathStartButton.js
78 lines (72 loc) · 1.65 KB
/
StartButton.js
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
import {StyleSheet, View, Text, Pressable} from 'react-native';
import React from 'react';
import FastImage from 'react-native-fast-image';
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
} from 'react-native-reanimated';
const StartButton = ({onPress}) => {
const openAnimation = useSharedValue(1);
const animatedWrapper = useAnimatedStyle(() => {
return {
opacity: openAnimation.value,
};
});
const onPressCard = () => {
openAnimation.value = withTiming(0);
onPress();
};
return (
<Pressable style={styles.cardWrapper} onPress={onPressCard}>
<Animated.View style={[animatedWrapper, styles.wrapperBack]}>
<View style={styles.wrapper}>
<FastImage
source={{
uri: 'https://image.flaticon.com/icons/png/512/3483/3483033.png',
}}
style={styles.reverseIcon}
/>
<Text style={styles.text}>Play</Text>
</View>
</Animated.View>
</Pressable>
);
};
const styles = StyleSheet.create({
wrapperBack: {
position: 'absolute',
height: 240,
width: 240,
backgroundColor: '#aaa',
borderRadius: 35,
overflow: 'hidden',
},
cardWrapper: {
height: 240,
width: 240,
position: 'absolute',
alignItems: 'center',
},
wrapper: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFCCD3',
},
reverseIcon: {
height: 140,
width: 140,
},
shadow: {
position: 'absolute',
zIndex: 100,
height: '100%',
width: '100%',
backgroundColor: 'black',
},
text: {
paddingTop: 20,
},
});
export default StartButton;