-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ios.js
88 lines (78 loc) · 1.71 KB
/
index.ios.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
80
81
82
83
84
85
86
87
88
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
const React = require('react')
const {ColoredView, NavigationBar} = require('react-native-ui')
const {
AppRegistry,
StyleSheet,
Text,
ScrollView,
View,
Image
} = require('react-native')
const Views = {
home: {
title: 'Home',
icon: 'home',
component: require('./views/Home'),
center: true
},
ranking: {
title: 'Ranking',
icon: 'trophy',
component: require('./views/Ranking')
},
progress: {
title: 'Progreso',
icon: 'graph-bar',
component: require('./views/Stats')
},
tips: {
title: 'Actividades',
icon: 'lightbulb',
component: require('./views/Tips')
}
}
const hackcancun = React.createClass({
getInitialState() {
return {
currentViewKey: 'home'
}
},
onNavigationChange(newTab) {
this.setState({
currentViewKey: newTab
})
},
render() {
const {currentViewKey} = this.state
const CurrentView = Views[currentViewKey].component
return (
<ColoredView color='#8E44AD' title={Views[currentViewKey].title} customStyles={customStyles}>
<View style={styles.scrollView} key={currentViewKey}>
<ScrollView style={styles.scrollView} centerContent={Views[currentViewKey].center}>
<CurrentView style={{flex: 1}}/>
</ScrollView>
</View>
<NavigationBar
active={currentViewKey}
content={Views}
onChange={this.onNavigationChange} />
</ColoredView>
);
}
})
const customStyles = {
container: {
backgroundColor: '#fff'
}
}
const styles = {
scrollView: {
flex: 1
}
}
AppRegistry.registerComponent('hackcancun', () => hackcancun);