-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTabs.tsx
61 lines (53 loc) · 1.63 KB
/
Tabs.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
import {
BottomTabNavigationOptions,
createBottomTabNavigator,
} from "@react-navigation/bottom-tabs";
import React, { ReactElement } from "react";
import { StatusBar } from "react-native";
import Icon from "react-native-vector-icons/Ionicons";
import Games from "./screens/Games";
import Home from "./screens/Home";
type TabStackParamList = {
Games: undefined;
Search: undefined;
Debug: undefined;
};
const Tab = createBottomTabNavigator<TabStackParamList>();
const Tabs = (): ReactElement | null => {
return (
<>
<StatusBar barStyle="dark-content" />
<Tab.Navigator
screenOptions={({ route }): BottomTabNavigationOptions => {
return {
tabBarIcon: ({ focused, color, size }): ReactElement => {
let iconName = "";
switch (route.name) {
case "Games":
iconName = focused
? "game-controller"
: "game-controller-outline";
break;
case "Search":
iconName = focused ? "search" : "search-outline";
break;
case "Debug":
iconName = focused ? "bug" : "bug-outline";
break;
}
return <Icon name={iconName} size={size} color={color} />;
},
};
}}
tabBarOptions={{
activeTintColor: "#007AFF",
inactiveTintColor: "#A3A3A3",
}}
>
<Tab.Screen name="Games" component={Games} />
<Tab.Screen name="Debug" component={Home} />
</Tab.Navigator>
</>
);
};
export default Tabs;