diff --git a/app/(tabs)/mapScreen.tsx b/app/(tabs)/mapScreen.tsx index 87155b7..d49992b 100644 --- a/app/(tabs)/mapScreen.tsx +++ b/app/(tabs)/mapScreen.tsx @@ -1,17 +1,40 @@ // MapScreen.tsx import { ThemedMapView } from '@/components/themed-mapview'; -import React from 'react'; -import { StyleSheet, View, Dimensions } from 'react-native'; -import MapView, { Marker, PROVIDER_DEFAULT } from 'react-native-maps'; +import React, { useEffect, useState } from 'react'; +import { StyleSheet, View, Dimensions, Image, Text } from 'react-native'; +import MapView, { Marker, Callout, CalloutSubview, PROVIDER_DEFAULT } from 'react-native-maps'; +import { db } from '../../firebase_config'; +import { Chantier } from '@/class/class'; +import { getChantiers } from '@/services/ressourcesService'; -const MapScreen: React.FC = () => { - const region = { + +const MapScreen = () => { + +const region = { latitude: 48.8566, longitude: 2.3522, latitudeDelta: 0.05, longitudeDelta: 0.05, }; + + const [chantiers, setMarkers] = useState([]); + const [loading, setLoading] = useState(true); + + useEffect(() => { + async function loadData() { + try { + const data = await getChantiers(); + setMarkers(data); + } catch (error) { + console.error("Erreur lors du chargement :", error); + } finally { + setLoading(false); + } + } + loadData(); + }, []); + return ( { style={styles.map} region={region} > + {chantiers.map(chantier => ( + ))} );