-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBottomTab.js
112 lines (107 loc) · 3.09 KB
/
BottomTab.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
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { Text, View, TouchableOpacity } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import AddExpensesScreen from "./screens/AddExpensesScreen";
import TrackerScreen from "./screens/TrackerScreen";
import CardsScreen from "./screens/CardsScreen";
import InvestmentsScreen from "./screens/InvestmentsScreen";
import BankingScreen from "./screens/BankingScreen";
const Tab = createBottomTabNavigator();
const CustomTabBarButton = ({ children, onPress, ...props }) => (
<TouchableOpacity
style={{
top: -25,
justifyContent: "center",
alignItems: "center",
}}
onPress={onPress}
>
<View
style={{
width: 39,
height: 39,
borderRadius: 5,
backgroundColor: props.focused
? "rgba(128,128,128,1)"
: "rgba(128,128,128,0.8)",
transform: [{ rotate: "45deg" }],
}}
>
{children}
</View>
</TouchableOpacity>
);
const Tabs = () => {
return (
<Tab.Navigator
initialRouteName="Add"
screenOptions={({ route }) => ({
tabBarShowLabel: true, // defaults to true
tabBarStyle: [
{
display: "flex",
},
null,
],
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === "Add") {
iconName = focused ? "close" : "close";
size = 35;
color = focused ? "#ffffff" : "#f0f0f0";
} else if (route.name === "Tracker") {
iconName = focused ? "chart-arc" : "chart-arc";
size = 25;
} else if (route.name === "Cards") {
iconName = focused
? "credit-card-settings"
: "credit-card-settings-outline";
size = 25;
} else if (route.name === "Investments") {
iconName = focused ? "finance" : "finance";
size = 25;
} else if (route.name === "Banking") {
iconName = focused ? "bank" : "bank-outline";
size = 25;
}
return <Icon name={iconName} size={size} color={color} />;
},
tabBarActiveTintColor: "black",
tabBarInactiveTintColor: "gray",
})}
>
<Tab.Screen
name="Banking"
component={BankingScreen}
options={{ headerShown: false }}
/>
<Tab.Screen
name="Cards"
component={CardsScreen}
options={{ headerShown: false }}
/>
<Tab.Screen
name="Add"
component={AddExpensesScreen}
options={{
headerShown: false,
tabBarLabel: "",
tabBarButton: (props) => (
<CustomTabBarButton {...props} focused={true} />
),
}}
/>
<Tab.Screen
name="Tracker"
component={TrackerScreen}
options={{ headerShown: false }}
/>
<Tab.Screen
name="Investments"
component={InvestmentsScreen}
options={{ headerShown: false }}
/>
</Tab.Navigator>
);
};
export default Tabs;