-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.android.js
70 lines (62 loc) · 1.31 KB
/
index.android.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
/* @flow */
'use strict';
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ViewPagerAndroid,
} from 'react-native';
const strings = require('./js/l10n/strings');
var Price = require('./js/price');
type State = {
title: string;
}
class Entry extends React.Component {
state: State;
constructor() {
super();
this.state = {
title: 'today',
};
}
render() {
return (
<View style={styles.container}>
<Text style={styles.title}>{this.state.title}</Text>
<ViewPagerAndroid
style={styles.viewPager}
onPageSelected={(e) => {
this.setState({title: e.nativeEvent.position === 0 ? strings.today : strings.pastYear});
}}
initialPage={0}>
<View style={styles.pageStyle}>
<Price type="today" />
</View>
<View style={styles.pageStyle}>
<Price type="year" />
</View>
</ViewPagerAndroid>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: '#F5FCFF',
},
title: {
textAlign: 'center',
marginTop: 10,
},
viewPager: {
flex: 1,
},
pageStyle: {
alignItems: 'stretch',
},
});
AppRegistry.registerComponent('GoldPrice', () => Entry);