-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavigation.tsx
124 lines (117 loc) · 3.47 KB
/
Navigation.tsx
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
import { NavigationContainer } from "@react-navigation/native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { createStackNavigator } from "@react-navigation/stack";
import HomeScreen from "@/screens/HomeScreen";
import SettingsScreen from "@/screens/SettingsScreen";
import VersusScreen from "@/screens/VersusScreen";
import RankScreen from "@/screens/RankScreen";
import UserStoredRankScreen from "@/screens/UserStoredRankScreen";
import { FontAwesome6 } from "@expo/vector-icons";
import { Entypo } from "@expo/vector-icons";
import { Fontisto } from "@expo/vector-icons";
import { Platform, StyleSheet } from "react-native";
import { useColorScheme } from "nativewind";
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();
export default function Navigation() {
return (
<NavigationContainer>
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name="Main" component={MainTabs} />
<Stack.Screen name="Versus" component={VersusScreen} />
<Stack.Screen name="Rank" component={RankScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
function MainTabs() {
const { colorScheme } = useColorScheme();
const styles = StyleSheet.create({
tabContainer: {
position: "absolute",
width: "90%",
borderRadius: 12,
left: "5%",
bottom: 20,
borderTopWidth: 0,
backgroundColor: colorScheme === "light" ? "#fff" : "#171717",
height: 60,
},
label: {
textTransform: "capitalize",
fontSize: 12,
},
});
return (
<Tab.Navigator
screenOptions={{
headerShown: false,
tabBarActiveTintColor: colorScheme === "light" ? "#000" : "#fff",
tabBarStyle: [
styles.tabContainer,
Platform.OS === "ios" && {
shadowOffset: { height: -2, width: 2 },
shadowOpacity: 0.1,
shadowRadius: 15,
},
],
tabBarItemStyle: {
marginBottom: 7,
},
tabBarInactiveTintColor: "#999",
}}
safeAreaInsets={{
bottom: 0,
}}
>
<Tab.Screen
name="Home"
component={HomeScreen}
options={{
tabBarLabel: "Home",
tabBarIcon: ({ focused }) => (
<Entypo
name="home"
size={24}
color={
focused ? (colorScheme === "light" ? "#000" : "#fff") : "#999"
}
/>
),
}}
/>
<Tab.Screen
name="Rankings"
component={UserStoredRankScreen}
options={{
tabBarLabel: "Rankings",
tabBarIcon: ({ focused }) => (
<FontAwesome6
name="ranking-star"
size={24}
color={
focused ? (colorScheme === "light" ? "#000" : "#fff") : "#999"
}
/>
),
}}
/>
<Tab.Screen
name="Settings"
component={SettingsScreen}
options={{
tabBarLabel: "Settings",
tabBarIcon: ({ focused }) => (
<Fontisto
name="player-settings"
size={24}
color={
focused ? (colorScheme === "light" ? "#000" : "#fff") : "#999"
}
/>
),
}}
/>
</Tab.Navigator>
);
}