-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
132 lines (124 loc) · 3.13 KB
/
App.js
File metadata and controls
132 lines (124 loc) · 3.13 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 React, { Component } from 'react';
import {
StyleSheet,
View,
Animated,
Image,
ImageBackground,
Text,
TouchableWithoutFeedback,
Alert,
} from 'react-native';
export default class ActionButton extends Component {
state = {
animation: new Animated.Value(0),
};
toggleOpen = () => {
if (this._open) {
Animated.timing(this.state.animation, {
toValue: 0,
duration: 1000,
}).start();
} else {
Animated.timing(this.state.animation, {
toValue: 1,
duration: 1000,
}).start();
}
this._open = !this._open
};
render() {
const printInterpolate = this.state.animation.interpolate({
inputRange: [0, 1],
outputRange: [0, -90],
});
const saveInterpolate = this.state.animation.interpolate({
inputRange: [0, 0.5, 1],
outputRange: [0, -80, -180],
});
const printStyle = {
transform: [
{
translateY: printInterpolate,
},
],
};
const saveStyle = {
transform: [
{
translateY: saveInterpolate,
},
],
};
return (
<View style={styles.container}>
<Animated.View style={[styles.background]}>
<TouchableWithoutFeedback onPress={() => Alert.alert('saveIconn')}>
<Animated.View style={[styles.button, saveStyle]}>
<Image
style={styles.iconStyle}
resizeMode="contain"
source={{
uri: 'https://www.freeiconspng.com/uploads/save-icon-31.png',
}}
/>
</Animated.View>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress={() => Alert.alert('printIcon')}>
<Animated.View style={[styles.button, printStyle]}>
<Image
style={styles.iconStyle}
resizeMode="contain"
source={{
uri:
'https://cdn4.iconfinder.com/data/icons/small-v2/512/device_document_electronic_print_printer_printing-512.png',
}}
/>
</Animated.View>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress={() => this.toggleOpen()}>
<Animated.View style={[styles.button]}>
<Image
style={styles.iconStyle}
resizeMode="contain"
source={{ uri: 'https://img.icons8.com/cotton/2x/plus.png' }}
/>
</Animated.View>
</TouchableWithoutFeedback>
</Animated.View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
background: {
position: 'absolute',
bottom: 20,
right: 20,
alignItems: 'center',
alignSelf: 'center',
width: 70,
height: 70,
},
button: {
// backgroundColor: 'grey',
position: 'absolute',
bottom: 20,
right: 20,
alignItems: 'center',
alignSelf: 'center',
shadowRadius: 4,
shadowOpacity: 1,
borderRadius: 40,
borderBottomColor: 12,
width: 70,
height: 70,
},
iconStyle: {
width: 60,
height: 60,
},
});