-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
118 lines (113 loc) · 4.24 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
import React, { useState, useEffect } from "react";
import { StyleSheet, Text, View, AppRegistry, ScrollView, TouchableWithoutFeedback } from "react-native";
import { NativeRouter, Route, Link, Routes } from "react-router-native";
import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
import {
faUser,
faHandshakeAngle,
faTree,
faSackDollar,
} from "@fortawesome/free-solid-svg-icons";
import Tree from "./pages/Tree";
import Funds from "./pages/Funds";
import Volunteer from "./pages/Volunteer";
import Profile from "./pages/Profile";
import Redeem from "./pages/Redeem";
import Activity from "./pages/activity";
import RedeemDetail from "./pages/RedeemDetail"
import FundsDetail from "./pages/FundsDetail";
export default function App() {
const [navIndex, setNavIndex] = useState(0);
return (
<NativeRouter>
<View style={styles.container}>
<ScrollView
style={styles.contentWrapper}
showsVerticalScrollIndicator={false}
showsHorizontalScrollIndicator={false}
>
<Routes>
<Route exact path="/" element={<Volunteer />} />
<Route path="/tree" element={<Tree />} />
<Route path="/funds" element={<Funds />} />
<Route path="/profile" element={<Profile />} />
<Route path="/activity" element={<Activity />} />
<Route path="/redeem" element={<Redeem />} />
<Route path="/redeem/:slug" element={<RedeemDetail />} />
<Route path="/funds/:slug" element={<FundsDetail />} />
</Routes>
</ScrollView>
<View style={styles.nav}>
<Link to="/" component={ TouchableWithoutFeedback } onPress={ () => setNavIndex(0) } underlayColor="#f0f4f7" style={styles.navItem}>
<View style={styles.subNavItem}>
<FontAwesomeIcon style={styles.navIcon} icon={faHandshakeAngle} color={navIndex === 0 ? "#2fac97" : "rgba(0, 0, 0, 0.3)"} />
<Text style={navIndex === 0 ? styles.navItemSelectedText : styles.navItemText}>Volunteer</Text>
</View>
</Link>
<Link to="/tree" component={ TouchableWithoutFeedback } onPress={ () => setNavIndex(1) } underlayColor="#f0f4f7" style={styles.navItem}>
<View style={styles.subNavItem}>
<FontAwesomeIcon style={styles.navIcon} icon={faTree} color={navIndex === 1 ? "#2fac97" : "rgba(0, 0, 0, 0.3)"} />
<Text style={navIndex === 1 ? styles.navItemSelectedText : styles.navItemText}>Tree</Text>
</View>
</Link>
<Link to="/funds" component={ TouchableWithoutFeedback } onPress={ () => setNavIndex(2) } underlayColor="#f0f4f7" style={styles.navItem}>
<View style={styles.subNavItem}>
<FontAwesomeIcon style={styles.navIcon} icon={faSackDollar} color={navIndex === 2 ? "#2fac97" : "rgba(0, 0, 0, 0.3)"} />
<Text style={navIndex === 2 ? styles.navItemSelectedText : styles.navItemText}>Funds</Text>
</View>
</Link>
<Link to="/profile" component={ TouchableWithoutFeedback } onPress={ () => setNavIndex(3) } underlayColor="#f0f4f7" style={styles.navItem}>
<View style={styles.subNavItem}>
<FontAwesomeIcon style={styles.navIcon} icon={faUser} color={navIndex === 3 ? "#2fac97" : "rgba(0, 0, 0, 0.3)"} />
<Text style={navIndex === 3 ? styles.navItemSelectedText : styles.navItemText}>Profile</Text>
</View>
</Link>
</View>
</View>
</NativeRouter>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
height: "100vh"
},
contentWrapper: {
marginBottom: 66
},
nav: {
flexDirection: "row",
justifyContent: "space-around",
borderTopWidth: 1,
borderTopColor: "rgba(170, 167, 167, 0.5)",
padding: 7,
position: "fixed",
bottom: 0,
width: "100%",
backgroundColor: "white",
},
navItem: {
flex: 1,
alignItems: "center",
padding: 10,
},
navItemSelectedText: {
color: "#2fac97"
},
navItemText: {
color: "rgba(0, 0, 0, 0.3)"
},
subNavItem: {
display: "flex",
alignItems: "center",
},
navIcon:{
height: 20,
width: 20,
marginBottom: 5,
},
topic: {
textAlign: "center",
fontSize: 15,
},
});