Stockage de la géolocalisation en arrière-plan et utilisation sur la carte
This commit is contained in:
@ -1,21 +1,18 @@
|
||||
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 { useBackgroundPermissions } 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)
|
||||
|
||||
|
||||
const [backgroundStatus, requestBackgroundPermission] = useBackgroundPermissions()
|
||||
if (!backgroundStatus?.granted && backgroundStatus?.canAskAgain)
|
||||
requestBackgroundPermission()
|
||||
|
||||
return (
|
||||
<ThemedView style={styles.page}>
|
||||
{locationAccessGranted ? <Map location={location} /> : <ThemedText>La géolocalisation est requise pour utiliser la carte.</ThemedText>}
|
||||
{backgroundStatus?.granted ? <Map /> : <ThemedText>La géolocalisation est requise pour utiliser la carte.</ThemedText>}
|
||||
</ThemedView>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user