-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
81 lines (70 loc) · 2.25 KB
/
App.js
File metadata and controls
81 lines (70 loc) · 2.25 KB
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
import React from 'react';
import styled from 'styled-components';
import { Entypo } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import HomeScreen from './components/screens/HomeScreen';
import LiveScreen from './components/screens/LiveScreen';
import ProfileScreen from './components/screens/ProfileScreen';
import GameScreen from './components/screens/GameScreen';
const AppStack = createStackNavigator();
const TabNav = createBottomTabNavigator();
const tabBarOptions = {
showLabel: false,
style: {
backgroundColor: '#343434',
borderTopColor: '#343434',
paddingBottom: 12,
}
}
const TabNavScreen = () => {
return (
<TabNav.Navigator
tabBarOptions={tabBarOptions}
screenOptions={({ route }) => ({
tabBarIcon: ({ focused }) => {
let iconName;
switch (route.name) {
case 'HomeScreen':
iconName = 'home';
break;
case 'LiveScreen':
iconName = 'game-controller';
break;
case 'ProfileScreen':
iconName = 'user';
break;
default:
iconName = 'home';
break;
}
return (
<TabBarIconContainer focused={focused}>
<Entypo name={iconName} size={24} color='#FFF' />
</TabBarIconContainer>
)
}
})}
>
<TabNav.Screen name="HomeScreen" component={HomeScreen} />
<TabNav.Screen name="LiveScreen" component={LiveScreen} />
<TabNav.Screen name="ProfileScreen" component={ProfileScreen} />
</TabNav.Navigator>
)
}
export default function App() {
return (
<NavigationContainer>
<AppStack.Navigator mode="modal" headerMode="none">
<AppStack.Screen name="App" component={TabNavScreen} />
<AppStack.Screen name="GameScreen" component={GameScreen} />
</AppStack.Navigator>
</NavigationContainer>
);
}
const TabBarIconContainer = styled.View`
background-color: ${props => props.focused ? '#819EE5' : '#343434'};
padding: 2px 16px;
border-radius: 32px;
`;