2024-12-02 19:11:31 +00:00
|
|
|
import { StyleSheet } from 'react-native'
|
|
|
|
import { ThemedView } from '@/components/ThemedView'
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
import "maplibre-gl/dist/maplibre-gl.css"
|
|
|
|
|
|
|
|
import * as Location from 'expo-location'
|
|
|
|
import Map from '@/components/map'
|
|
|
|
import { ThemedText } from '@/components/ThemedText'
|
|
|
|
|
|
|
|
export default function MapScreen() {
|
|
|
|
const [location, setLocation] = useState<Location.LocationObject | null>(null)
|
|
|
|
const [locationAccessGranted, setLocationAccessGranted] = useState(false)
|
|
|
|
|
2024-12-06 18:00:51 +00:00
|
|
|
|
2024-12-02 19:11:31 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<ThemedView style={styles.page}>
|
|
|
|
{locationAccessGranted ? <Map location={location} /> : <ThemedText>La géolocalisation est requise pour utiliser la carte.</ThemedText>}
|
|
|
|
</ThemedView>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
page: {
|
|
|
|
flex: 1,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center'
|
|
|
|
},
|
|
|
|
map: {
|
|
|
|
flex: 1,
|
|
|
|
alignSelf: 'stretch',
|
|
|
|
},
|
|
|
|
});
|