-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
178 lines (165 loc) · 5.08 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
172
173
174
175
176
177
178
import { StatusBar } from "expo-status-bar";
import React, { useRef } from "react";
import {
Animated,
Dimensions,
Image,
Platform,
StyleSheet,
Text,
TouchableOpacity,
View,
} from "react-native";
import "react-native-gesture-handler";
import { NavigationContainer } from "@react-navigation/native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { FontAwesome5 } from "@expo/vector-icons"; // Font Awesome Icons
// import plus from "./assets/plus.png"; // Plus...
import tori_icon from "./assets/tori_icon.png";
import profile_icon from "./assets/profile_icon.png";
import dojo_icon from "./assets/dojo_icon.png";
import feed_icon from "./assets/feed_icon.png";
import calendar_icon from "./assets/calendar_icon.png";
const Tab = createBottomTabNavigator();
export default function App() {
const tabOffsetValue = useRef(new Animated.Value(0)).current;
return (
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName;
let iconStyle = focused
? { width: 25, height: 25, tintColor: "red" } // Icon color is red when focused
: { width: 25, height: 25, tintColor: "#899499" };
if (route.name === "Dojo") {
iconName = dojo_icon;
} else if (route.name === "Feed") {
iconName = feed_icon;
} else if (route.name === "Calendar") {
iconName = calendar_icon;
} else if (route.name === "Profile") {
iconName = profile_icon;
} else if (route.name === "ActionButton") {
return (
<TouchableOpacity>
<View
style={{
width: 65,
height: 65,
backgroundColor: "red",
borderRadius: 40,
justifyContent: "center",
alignItems: "center",
marginBottom: Platform.OS === "android" ? 70 : 50,
}}
>
<Image
source={tori_icon}
style={{
width: 25,
height: 25,
tintColor: "white",
}}
></Image>
</View>
</TouchableOpacity>
);
}
// Return custom icons
return <Image source={iconName} style={iconStyle} />;
// You can return any component that you like here!
// return (
// <FontAwesome5
// name={iconName}
// size={size}
// color={focused ? "red" : "gray"}
// />
// );
},
tabBarShowLabel: false,
tabBarStyle: {
backgroundColor: "white",
position: "absolute",
bottom: 40,
marginHorizontal: 20,
height: 80,
borderRadius: 40,
shadowColor: "#000",
shadowOpacity: 0.06,
shadowOffset: {
width: 10,
height: 10,
},
paddingHorizontal: 15,
paddingVertical: 20,
},
})}
>
<Tab.Screen name="Dojo" component={DojoScreen} />
<Tab.Screen name="Feed" component={FeedScreen} />
<Tab.Screen name="ActionButton" component={ToriScreen} />
<Tab.Screen name="Calendar" component={CalendarScreen} />
<Tab.Screen name="Profile" component={ProfileScreen} />
</Tab.Navigator>
{/* <Animated.View
style={{
width: getWidth() - 20,
height: 2,
backgroundColor: "red",
position: "absolute",
bottom: 98,
left: 50,
borderRadius: 20,
transform: [{ translateX: tabOffsetValue }],
}}
></Animated.View> */}
</NavigationContainer>
);
}
function getWidth() {
let width = Dimensions.get("window").width;
width = width - 80; // Horizontal Padding = 20...
return width / 5; // Total five Tabs...
}
function ToriScreen() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }} />
);
}
function ProfileScreen() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Profile</Text>
</View>
);
}
function DojoScreen() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Dojo</Text>
</View>
);
}
function CalendarScreen() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Calendar</Text>
</View>
);
}
function FeedScreen() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Feed</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});