-
Notifications
You must be signed in to change notification settings - Fork 5
/
QuoteScreen.js
73 lines (67 loc) · 1.49 KB
/
QuoteScreen.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
import React, { Component, PropTypes } from 'react'
import {
StyleSheet,
View,
Image,
LayoutAnimation,
} from 'react-native'
import Quote from './Quote'
import NextQuoteButton from './NextQuoteButton'
const bgImage = require('./assets/bg.png')
const tranquil = {
duration: 500,
create: {
duration: 1000,
delay: 300,
type: LayoutAnimation.Types.easeIn,
property: LayoutAnimation.Properties.opacity,
},
update: {
type: LayoutAnimation.Types.easeInEaseOut,
property: LayoutAnimation.Properties.opacity,
},
delete: {
duration: 200,
type: LayoutAnimation.Types.easeOut,
property: LayoutAnimation.Properties.opacity,
},
}
class QuoteScreen extends Component {
componentWillUpdate() {
LayoutAnimation.configureNext(tranquil)
}
render() {
return (
<Image source={bgImage} style={styles.backgroundContainer}>
<View style={styles.container}>
<Quote
key={this.props.qId}
quoteText={this.props.text}
quoteSource={this.props.source}
/>
<NextQuoteButton onPress={this.props.onNextQuotePress} />
</View>
</Image>
)
}
}
QuoteScreen.propTypes = {
text: PropTypes.string.isRequired,
source: PropTypes.string.isRequired,
onNextQuotePress: PropTypes.func.isRequired,
qId: PropTypes.number.isRequired,
}
const styles = StyleSheet.create({
backgroundContainer: {
flex: 1,
resizeMode: 'cover',
width: undefined,
height: undefined,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
})
export default QuoteScreen