-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
149 lines (141 loc) · 3.98 KB
/
App.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import { NativeWindStyleSheet } from "nativewind";
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
import 'intl-pluralrules';
import 'core-js';
import AuthProvider from "./src/context/AuthContext";
import Navigation from "./src/navigation/Navigation";
import I18nProvider from "./src/context/I18nContext";
import Toast from "react-native-toast-message";
import React from "react";
NativeWindStyleSheet.setOutput({
default: "native",
});
const queryClient = new QueryClient()
export default function App() {
// const handleLogin = async () => {
// try {
// // Effectuez la connexion, par exemple en appelant une API
// // Si la connexion réussit, mettez à jour l'état d'authentification
// setUserIsAuthenticated(true);
// } catch (error) {
// console.error('Erreur lors de la connexion : ', error);
// }
// };
//
// const handleLogout = async () => {
// try {
// setUserIsAuthenticated(false);
// } catch (error) {
// console.error('Erreur lors de la deconnexion : ', error);
// }
// }
return (
<QueryClientProvider client={queryClient}>
<I18nProvider>
<AuthProvider>
<Navigation />
<Toast />
</AuthProvider>
</I18nProvider>
</QueryClientProvider>
);
}
// export default function App() {
//
// const [userIsAuthenticated, setUserIsAuthenticated] = useState(false);
//
// useEffect(() => {
// const checkAuthentication = async () => {
// const token = await AsyncStorage.getItem('authToken');
// if (token) {
// setUserIsAuthenticated(true);
// }
// };
//
// checkAuthentication();
// }, []);
//
// // Fonction pour gérer la connexion de l'utilisateur et mettre à jour l'état d'authentification
// const handleLogin = async () => {
// // Effectuez la connexion, par exemple en appelant une API
// try {
// // Remplacez ce code par la logique de connexion réelle
// // Si la connexion réussit, mettez à jour l'état d'authentification
// setUserIsAuthenticated(true);
// } catch (error) {
// console.error('Erreur lors de la connexion : ', error);
// }
// };
//
// const handleLogout = async () => {
// try {
// setUserIsAuthenticated(false)
// } catch (error) {
// console.error('Erreur lors de la deconnexion : ', error)
// }
// }
//
// return (
// <QueryClientProvider client={queryClient}>
// <NavigationContainer>
// {userIsAuthenticated ? (
// <Tab.Navigator
// screenOptions={{
// //TODO mettre une couleur de la palette
// tabBarActiveTintColor: '#a83232',
// }}
// >
// <Tab.Screen
// name="Home"
// component={Home}
// options={{
// tabBarIcon: ({ color, size }) => (
// <MaterialCommunityIcons name="home" color={color} size={size} />
// ),
// }}
// />
// <Tab.Screen
// name="Messages"
// component={Conversation}
// options={{
// tabBarIcon: ({ color, size }) => (
// <MaterialCommunityIcons name="message" color={color} size={size} />
// ),
// }}
// />
// <Tab.Screen
// name="Offer"
// component={Offer}
// options={{
// tabBarIcon: ({ color, size }) => (
// <MaterialIcons name="work" color={color} size={size} />
// ),
// }}
// />
// <Tab.Screen
// name="Notifications"
// component={Notification}
// options={{
// tabBarIcon: ({ color, size }) => (
// <MaterialCommunityIcons name="bell" color={color} size={size} />
// ),
// }}
// />
// <Tab.Screen
// name="Profile"
// children={() => <Profile onLogout={handleLogout}/>}
// // initialParams={{ onLogout: handleLogout }}
// options={{
// tabBarIcon: ({ color, size }) => (
// <FontAwesome name="user" color={color} size={size} />
// ),
// }}
// />
// </Tab.Navigator>
// ) : (
// <Login onLogin={handleLogin} />
// )}
// </NavigationContainer>
// </QueryClientProvider>
// );
// }