Browse Source

Map focus in Brasil while loading user location

master
GabrielTrettel 4 years ago
parent
commit
4fa760a6c5
  1. 17
      src/app/screens/MapFeedScreen.js

17
src/app/screens/MapFeedScreen.js

@ -11,16 +11,19 @@ import attachFocusToQuery from "../hooks/useFocus";
import { CurrentLocationContext } from "../context/CurrentLocationContext";
function MapFeedScreen(props) {
const context = useContext(CurrentLocationContext);
const location = context.currentCoordinates;
//const context = useContext(CurrentLocationContext)
const hasToQuery = attachFocusToQuery();
const markers = useMarkers(hasToQuery);
// console.log(markers);
const default_location = {
latitude: -12.901799,
longitude: -51.692116,
latitudeDelta: 70,
longitudeDelta: 70 * (screen_width / screen_height),
};
const map_scale = 0.003;
const lat_long_delta = {
latitudeDelta: map_scale,
@ -32,11 +35,7 @@ function MapFeedScreen(props) {
<MapView
style={styles.mapStyle}
showsUserLocation={true}
initialRegion={{
latitude: -22.1070263,
longitude: -51.3948396,
...lat_long_delta,
}}
initialRegion={{ ...default_location }}
region={{
latitude: location["latitude"],
longitude: location["longitude"],

Loading…
Cancel
Save