-
Notifications
You must be signed in to change notification settings - Fork 9
/
Splash.js
79 lines (69 loc) · 1.47 KB
/
Splash.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
'use strict';
import React, { Component,PropTypes } from 'react';
import {
StyleSheet,
Image,
View,
} from 'react-native';
var Animated = require('Animated');
import Util from './view/Util';
export default class Splash extends Component{
static propsTypes={
style:View.propTypes.style,
onAnimEnd:PropTypes.func,
}
constructor(props){
super(props);
this.state={
bounceAnimValue:new Animated.Value(1),
opacityAnimValue:new Animated.Value(1),
};
}
componentDidMount(){
Animated.timing(
this.state.bounceAnimValue,
{
toValue: 0.8,
duration: 400,
delay:1000,
}
).start();
Animated.timing(
this.state.opacityAnimValue,
{
toValue:0,
duration:400,
delay:1000,
}
).start();
this.state.bounceAnimValue.addListener(value=>{
if(value.value=='0.8'){
this.props.onAnimEnd();
}
});
}
render(){
return(
<View style={[styles.container,this.props.style]}>
<Animated.Image
source={require('./images/splash.jpg')}
style={{
flex: 1,
width: Util.size.width,
height:null,
opacity: this.state.opacityAnimValue,
transform: [
{scale: this.state.bounceAnimValue},
],
}} />
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
position:'absolute',
height:500,
},
});