-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewBox.js
More file actions
115 lines (107 loc) · 2.58 KB
/
newBox.js
File metadata and controls
115 lines (107 loc) · 2.58 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
import React, {Component} from 'react';
import {Image, View, StyleSheet, Text, Animated} from 'react-native';
const fadeIn = duration => {
// Will change fadeAnim value to 1 in 5 seconds
Animated.timing(this.state.fadeAnim, {
toValue: 1,
duration: duration,
}).start();
};
class Start extends Component {
constructor(props) {
super(props);
this.state = {
fadeAnim1: new Animated.Value(0),
fadeAnim2: new Animated.Value(0),
logoAnimae: new Animated.Value(2),
loading: false,
};
}
componentDidMount() {
Animated.parallel([
Animated.spring(this.state.logoAnimae, {
toValue: 1,
// tension: 10,
// friction: 2,
duration: 1400,
}).start(),
Animated.timing(this.state.fadeAnim1, {
toValue: 1,
duration: 1800,
}),
Animated.timing(this.state.fadeAnim2, {
toValue: 1,
duration: 2400,
}),
]).start(() => {
this.setState({loading: true});
});
}
render() {
return (
<View style={styles.container}>
<Animated.View
style={[
{
opacity: this.state.logoAnimae,
left: this.state.logoAnimae.interpolate({
inputRange: [0, 1],
outputRange: [140, 0],
}),
},
]}>
<Image
source={{
uri:
'https://images.unsplash.com/photo-1618417789032-4650eed12873?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw2NHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60',
}}
resizeMode="contain"
style={styles.img}
/>
</Animated.View>
<Animated.View
style={[
{
opacity: this.state.fadeAnim1,
},
]}>
<Text style={styles.title}>some text</Text>
</Animated.View>
<Animated.View
style={[
{
opacity: this.state.fadeAnim2,
},
]}>
<Text style={styles.title}>nothing new</Text>
</Animated.View>
</View>
);
}
}
const styles = StyleSheet.create({
img: {
width: 200,
height: 200,
alignSelf: 'center',
// paddingBottom: 80,
marginBottom: 100,
},
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
title: {
// flexShrink: 1,
// flexWrap: 'wrap',
color: '#eb1c50',
fontSize: 16,
margin: 5,
},
backgroundImage: {
flex: 1,
resizeMode: 'cover', // or 'stretch'
},
});
export default Start;