|
@ -19,12 +19,18 @@ const MapFormScreen = (props) => { |
|
|
const location = contextLocation.currentCoordinates; |
|
|
const location = contextLocation.currentCoordinates; |
|
|
|
|
|
|
|
|
const [marker, setMarker] = useState(context.eventCoordinates); |
|
|
const [marker, setMarker] = useState(context.eventCoordinates); |
|
|
|
|
|
// console.log(marker);
|
|
|
|
|
|
|
|
|
const getAddress = async (coordenadas) => { |
|
|
const getAddress = async (coordenadas) => { |
|
|
Location.setGoogleApiKey("AIzaSyD_wuuokS3SVczc8qSASrsBq0E5qIpdyMc"); |
|
|
Location.setGoogleApiKey("AIzaSyD_wuuokS3SVczc8qSASrsBq0E5qIpdyMc"); |
|
|
|
|
|
|
|
|
const address = await Location.reverseGeocodeAsync(coordenadas); |
|
|
const address = await Location.reverseGeocodeAsync(coordenadas); |
|
|
context.saveNewLocation(address[0].street + ", " + address[0].name + "\n" + address[0].district, coordenadas); |
|
|
|
|
|
|
|
|
if (address[0] != undefined) { |
|
|
|
|
|
context.saveNewLocation(address[0].street + ", " + address[0].name + "\n" + address[0].district, coordenadas); |
|
|
|
|
|
} |
|
|
|
|
|
else{//Quando o usuário não da permissão de acesso da localização o geoCode retorna um array vazio
|
|
|
|
|
|
context.saveNewLocation("Erro ao carregar endereço", coordenadas); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const setLocation = () => { |
|
|
const setLocation = () => { |
|
|