forked from catalinmiron/react-native-dribbble-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ios.js
More file actions
100 lines (91 loc) · 2.12 KB
/
index.ios.js
File metadata and controls
100 lines (91 loc) · 2.12 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
/**
* Dribbble App
* Github url: https://github.com/catalinmiron/react-native-dribbble-app
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
NavigatorIOS,
StyleSheet,
TabBarIOS,
View,
Text
} = React;
var ShotList = require('./app/ShotList'),
Icon = require('FontAwesome');
var DribbbleApp = React.createClass({
getInitialState: function() {
return {
selectedTab: 'popular'
};
},
_renderContent: function(category: string) {
return (
<NavigatorIOS style={styles.wrapper}
initialRoute={{
component: ShotList,
title: category,
passProps: {filter: category}
}}
/>
);
},
render: function() {
return (
<TabBarIOS>
<Icon.TabBarItem
title="Popular"
iconName="heart"
selectedIconName="heart"
selected={this.state.selectedTab === 'popular'}
onPress={() => {
this.setState({
selectedTab: 'popular',
});
}}>
{this._renderContent('popular')}
</Icon.TabBarItem>
<Icon.TabBarItem
title="Debuts"
iconName="trophy"
selectedIconName="trophy"
selected={this.state.selectedTab === 'debuts'}
onPress={() => {
this.setState({
selectedTab: 'debuts',
});
}}>
{this._renderContent('debuts')}
</Icon.TabBarItem>
<Icon.TabBarItem
title="Everyone"
iconName="dribbble"
selectedIconName="dribbble"
selected={this.state.selectedTab === 'everyone'}
onPress={() => {
this.setState({
selectedTab: 'everyone',
});
}}>
{this._renderContent('everyone')}
</Icon.TabBarItem>
</TabBarIOS>
);
}
});
var styles = StyleSheet.create({
tabContent: {
flex: 1,
alignItems: 'center',
},
tabText: {
color: 'white',
margin: 50,
},
wrapper: {
flex: 1
}
});
AppRegistry.registerComponent('DribbbleApp', () => DribbbleApp);
module.exports = DribbbleApp;