-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
171 lines (164 loc) · 4.77 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import * as React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {Text, View, TouchableOpacity, Image} from 'react-native';
import {CalendarPage, HomeScreen, ChallengesPage} from './Components';
import {Colors as Color, Colors} from './Colors';
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {
faSeedling,
faTrophy,
faCommentDots,
faTree,
faLeaf,
faHome,
faUser,
faCalendarDay,
} from '@fortawesome/free-solid-svg-icons';
import house from './Assets/Images/house.png';
const Tab = createBottomTabNavigator();
function StatsScreen() {
return (
<View
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
height: '100%',
backgroundColor: Colors.primary,
}}>
<Image
source={require('./Assets/Images/overall-stats.png')}
resizeMode={'contain'}
style={{width: '100%'}}
/>
</View>
);
}
function ForumScreen() {
return (
<View
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
height: '100%',
backgroundColor: Colors.base,
}}>
<Text
style={{
color: Colors.accent,
fontFamily: 'Euphemia UCAS Regular 2.6.6',
}}>
Expect exciting community initiatives about sustainability!
</Text>
</View>
);
}
const App = () => {
const user = require('./Assets/Images/user.png');
const house = require('./Assets/Images/wallless-house.png');
return (
<NavigationContainer>
<Tab.Navigator
initialRouteName="Tasks"
screenOptions={({route}) => ({
tabBarIcon: ({focused, color, size}) => {
let iconName;
if (route.name === 'Forum') {
return (
<FontAwesomeIcon
icon={faCommentDots}
color={Colors.accent}
size={size}
/>
);
} else if (route.name === 'Record') {
return (
<FontAwesomeIcon
icon={faCalendarDay}
color={Colors.accent}
size={size}
/>
);
} else if (route.name === 'Tasks') {
return (
<FontAwesomeIcon
icon={faSeedling}
color={Colors.accent}
size={size}
/>
);
} else if (route.name === 'Challenges') {
return (
<FontAwesomeIcon
icon={faTrophy}
color={Colors.accent}
size={size}
/>
);
} else if (route.name === 'Statistics') {
return (
<FontAwesomeIcon
icon={faTree}
color={Colors.accent}
size={size}
/>
);
}
// You can return any component that you like here!
return (
<FontAwesomeIcon
icon={faLeaf}
color={Colors.accent}
size={size}
/>
);
},
tabBarActiveTintColor: Color.accent,
tabBarInactiveTintColor: Colors.accent,
tabBarActiveBackgroundColor: Colors.secondary,
headerStyle: {
backgroundColor: Colors.primary,
},
headerTitleAlign: 'center',
headerTitleStyle: {
fontFamily: 'Lemon Tuesday',
fontSize: 30,
color: Colors.accent,
},
headerTitle: ({allowFontScaling, tintColor, style, children}) => {
return <Text style={{...style}}>Plantey</Text>;
},
headerLeft: () => (
<Image
resizeMode="contain"
style={{position: 'absolute', width: 40, left: 10}}
source={house}
/>
),
headerRight: () => (
<Image
resizeMode="contain"
style={{position: 'absolute', width: 40, right: 5}}
source={user}
/>
),
})}>
<Tab.Screen name="Forum" component={ForumScreen} />
<Tab.Screen name="Record" component={CalendarPage} />
<Tab.Screen
name="Tasks"
component={HomeScreen}
options={{
tabBarBadge: 4,
tabBarBadgeStyle: {backgroundColor: Colors.base},
}}
/>
<Tab.Screen name="Challenges" component={ChallengesPage} />
<Tab.Screen name="Statistics" component={StatsScreen} />
</Tab.Navigator>
</NavigationContainer>
);
};
export default App;