-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
103 lines (98 loc) · 2.81 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import React, { useEffect } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { SafeAreaView, StyleSheet } from 'react-native';
import HomeScreen from './frontend/screens/HomeScreen.js';
import LoginScreen from './frontend/screens/LoginScreen.js';
import ProfileScreen from './frontend/screens/ProfileScreen.js';
import RadarScreen from './frontend/screens/RadarScreen.js';
import { MaterialCommunityIcons } from "@expo/vector-icons";
import client from './backend/receive.js';
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
const MainNavigator = () => {
return (
<Tab.Navigator
screenOptions={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'gray',
tabBarStyle: { backgroundColor: '#000', borderTopWidth: 0 },
headerShown: false,
}}
>
<Tab.Screen
name="Home"
component={HomeScreen}
options={{
tabBarIcon: ({ color, size }) => (
<MaterialCommunityIcons name="home" color={color} size={size} />
),
}}
/>
<Tab.Screen
name="Radar"
component={RadarScreen}
options={{
tabBarIcon: ({ color, size }) => (
<MaterialCommunityIcons name="radar" color={color} size={size} />
),
}}
/>
<Tab.Screen
name="Profile"
component={ProfileScreen}
options={{
tabBarIcon: ({ color, size }) => (
<MaterialCommunityIcons name="account" color={color} size={size} />
),
}}
/>
</Tab.Navigator>
);
};
export default function App() {
useEffect(() => {
if (client.isConnected()) {
console.log("MQTT est prêt !");
}
}, []);
return (
<SafeAreaView style={styles.safeArea}>
<NavigationContainer>
<Stack.Navigator
initialRouteName="Login"
screenOptions={{
headerStyle: { backgroundColor: '#000' },
headerTintColor: '#fff',
headerTitleAlign: 'center',
}}
>
<Stack.Screen
name="Login"
component={LoginScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Home"
component={MainNavigator}
options={{
title: "Kıbrıs Radar",
headerLeft: null // Empêche le retour à la page login
}}
/>
</Stack.Navigator>
</NavigationContainer>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
safeArea: {
flex: 1,
backgroundColor: '#000',
},
container: {
flex: 1,
backgroundColor: '#121212',
},
});