-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFade.js
82 lines (77 loc) · 1.56 KB
/
Fade.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
79
80
81
82
import React, { Component } from "react";
import {
Text,
View,
StyleSheet,
Animated,
TouchableOpacity,
Easing
} from "react-native";
export default class Fade extends Component {
state = {
fadeValue: new Animated.Value(0)
};
_start = () => {
Animated.timing(this.state.fadeValue, {
toValue: 1,
duration: 1000,
easing:Easing.linear
}).start();
};
render() {
return (
<View style={styles.container}>
<TouchableOpacity style={styles.btn} onPress={() => this._start()}>
<Text style={styles.textBtn}>Start</Text>
</TouchableOpacity>
<Animated.View
style={{
opacity: this.state.fadeValue,
height: 250,
width: 200,
margin: 5,
borderRadius: 12,
backgroundColor: "#347a2a",
justifyContent: "center"
}}
>
<Text style={styles.text}>Fade </Text>
</Animated.View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#FFF",
alignItems: "center",
justifyContent: "center"
},
item: {},
btn: {
backgroundColor: "#480032",
width: 100,
height: 40,
padding: 3,
justifyContent: "center",
borderRadius: 6
},
text: {
fontSize: 20,
color: "#fff",
fontWeight: "bold",
textAlign: "center"
},
item1: {
backgroundColor: "red",
padding: 20,
width: 100,
margin: 10
},
textBtn: {
color: "#f4f4f4",
fontWeight: "bold",
textAlign: "center"
}
});