-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
80 lines (73 loc) · 2.3 KB
/
main.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
import 'react-native-gesture-handler';
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
// redux
import {connect, useSelector} from 'react-redux';
// vistas stack
import SignIn from './views/stack/SignIn';
import Register from './views/stack/Register';
// vistas bottom
import Home from './views/bottom/Home';
import Profile from './views/bottom/Profile';
import Ranking from './views/bottom/Ranking';
// navegadores
const AuthStack = createStackNavigator();
const Tabs = createBottomTabNavigator();
const App = () => {
const loggedIn = useSelector(state => state.auth.loggedIn);
return (
<NavigationContainer>
{loggedIn ? (
<Tabs.Navigator initialRouteName="home">
<Tabs.Screen
name="ranking"
component={Ranking}
options={{
tabBarLabel: 'Ranking',
tabBarIcon: ({color, size}) => (
<FontAwesomeIcon name="trophy" color={color} size={size} />
),
}}
/>
<Tabs.Screen
name="home"
component={Home}
options={{
tabBarLabel: 'Home',
tabBarIcon: ({color, size}) => (
<FontAwesomeIcon name="home" color={color} size={size} />
),
}}
/>
<Tabs.Screen
name="profile"
component={Profile}
options={{
tabBarLabel: 'Profile',
tabBarIcon: ({color, size}) => (
<FontAwesomeIcon name="user-alt" color={color} size={size} />
),
}}
/>
</Tabs.Navigator>
) : (
<AuthStack.Navigator headerMode="none">
<AuthStack.Screen
name="signin"
component={SignIn}
options={{title: 'Iniciar Sesión'}}
/>
<AuthStack.Screen
name="register"
component={Register}
options={{title: 'Registro'}}
/>
</AuthStack.Navigator>
)}
</NavigationContainer>
);
};
export default connect(null, {})(App);