This repository has been archived by the owner on Jun 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
66 lines (63 loc) · 2.02 KB
/
App.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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import TabNavigator from 'react-native-tab-navigator';
import Icon from 'react-native-vector-icons/FontAwesome';
import News from './pages/News';
import Results from './pages/Results';
import About from './pages/About';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = { selectedTab: 'news' };
}
render() {
return (
<TabNavigator tabBarStyle={styles.tabbar}>
<TabNavigator.Item
selected={this.state.selectedTab === 'news'}
title="News"
renderIcon={() => <Icon name="newspaper-o" size={30} />}
renderSelectedIcon={() => <Icon name="newspaper-o" size={30} />}
onPress={() => this.setState({ selectedTab: 'news' })}>
<View style={styles.container}>
<News />
</View>
</TabNavigator.Item>
<TabNavigator.Item
selected={this.state.selectedTab === 'results'}
title="Results"
renderIcon={() => <Icon name="table" size={30} />}
renderSelectedIcon={() => <Icon name="table" size={30} />}
onPress={() => this.setState({ selectedTab: 'results' })}>
<View style={styles.container}>
<Results />
</View>
</TabNavigator.Item>
<TabNavigator.Item
selected={this.state.selectedTab === 'about'}
title="About"
renderIcon={() => <Icon name="home" size={30} />}
renderSelectedIcon={() => <Icon name="home" size={30} />}
onPress={() => this.setState({ selectedTab: 'about' })}>
<View style={styles.container}>
<About />
</View>
</TabNavigator.Item>
</TabNavigator>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
marginTop: 48,
marginBottom: 24,
},
tabbar: {
paddingBottom: 16,
height: 72,
},
});