-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
87 lines (81 loc) · 2.57 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
import React, { useEffect, useState } from "react";
import { StyleSheet } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import useLoadStatic from "./src/providers/hooks/useLoadStatic";
import Login from "./src/views/Login/Login";
import Register from "./src/views/Register/Register";
import Perfil from "./src/views/Perfil/Perfil";
import Buscador from "./src/views/Buscador/Buscador";
import SplashScreen from "./src/components/SplashScreen";
import { ContextProvider } from "./src/providers/ContextProvider";
const Stack = createStackNavigator();
const App = () => {
const [loading, logged, setLogged] = useLoadStatic([
require("./assets/1.jpg"),
require("./assets/2.png"),
require("./assets/3.png"),
require("./assets/4.jpg"),
require("./assets/5.jpg"),
]);
const Mensajes = () => <></>;
return loading ? (
<SplashScreen />
) : (
<ContextProvider>
<NavigationContainer>
<Stack.Navigator initialRouteName="Login">
{!logged ? (
<>
<Stack.Screen
name="Login"
component={Login}
initialParams={{ set: setLogged }}
options={{
title: "Ingresar a Mis Citas",
headerStyle: styles.header,
headerTitleStyle: { color: "white" },
}}
/>
<Stack.Screen
name="Register"
component={Register}
options={{
title: "Registrarme",
headerStyle: styles.header,
headerTitleStyle: { color: "white" },
headerBackTitleStyle: { color: "white" },
headerBackTitle: "Volver",
}}
/>
</>
) : (
<>
<Stack.Screen
name="Perfil"
component={Perfil}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Buscador"
component={Buscador}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Mensajes"
component={Mensajes}
options={{ headerShown: false }}
/>
</>
)}
</Stack.Navigator>
</NavigationContainer>
</ContextProvider>
);
};
const styles = StyleSheet.create({
header: {
backgroundColor: "#C52233",
},
});
export default App;