Skip to content

Commit 783e530

Browse files
committed
Experimental entrance screen
1 parent 1935573 commit 783e530

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

app/components/Entrance/index.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import React, { Component } from 'react'
2+
import {
3+
Animated,
4+
Easing,
5+
Image,
6+
RefreshControl,
7+
ScrollView,
8+
StyleSheet,
9+
TabBarIOS,
10+
Text,
11+
TouchableHighlight,
12+
View
13+
} from 'react-native';
14+
15+
import sizing from '../../utils/sizing';
16+
17+
import Icon from 'react-native-vector-icons/Ionicons';
18+
const AnimatedIcon = Animated.createAnimatedComponent(Icon);
19+
20+
export class Entrance extends Component{
21+
static propTypes = {
22+
hideThis: React.PropTypes.func.isRequired,
23+
};
24+
25+
constructor() {
26+
super();
27+
this.state = {
28+
transformAnim: new Animated.Value(1),
29+
opacityAnim: new Animated.Value(1),
30+
};
31+
}
32+
33+
componentDidMount() {
34+
Animated.timing(
35+
this.state.transformAnim,
36+
{toValue: 50,
37+
duration: 1200,
38+
delay:2000,
39+
easing: Easing.elastic(2),
40+
},
41+
).start();
42+
Animated.timing(
43+
this.state.opacityAnim,
44+
{toValue: 0,
45+
duration: 800,
46+
easing: Easing.elastic(1),
47+
delay:2200,
48+
},
49+
).start();
50+
setTimeout(() => {
51+
this.props.hideThis();
52+
}, 3300);
53+
}
54+
55+
render () {
56+
return(
57+
<Animated.View style={[styles.entrance,{opacity:this.state.opacityAnim}]}>
58+
<AnimatedIcon size={60} style={[styles.twitter,{transform:[{scale:this.state.transformAnim}]}]} name="social-twitter"></AnimatedIcon>
59+
</Animated.View>
60+
)
61+
}
62+
}
63+
64+
export default Entrance;
65+
66+
const styles = StyleSheet.create({
67+
entrance:{
68+
position: "absolute",
69+
top:0, left:0,
70+
height: sizing.height,
71+
width: sizing.width,
72+
backgroundColor:"#1b95e0",
73+
alignItems:"center",
74+
justifyContent:"center"
75+
}
76+
});

app/utils/sizing.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React,{PixelRatio} from 'react-native';
2+
import Dimensions from 'Dimensions';
3+
4+
const {width, height} = Dimensions.get('window');
5+
6+
export const Util = {
7+
ratio: PixelRatio.get(),
8+
pixel: 1 / PixelRatio.get(),
9+
size: {
10+
width, height
11+
}
12+
}
13+
14+
export default Util;

0 commit comments

Comments
 (0)