|
@ -1,33 +1,20 @@ |
|
|
import React, { useState, useEffect, useContext } from "react"; |
|
|
|
|
|
import { StyleSheet, Text, View } from "react-native"; |
|
|
|
|
|
|
|
|
import React, { useEffect, useContext } from "react"; |
|
|
|
|
|
import { StyleSheet, View } from "react-native"; |
|
|
import OpenStreetMap from "../components/map/OpenStreetMap"; |
|
|
import OpenStreetMap from "../components/map/OpenStreetMap"; |
|
|
import { CurrentLocationContext } from "../context/CurrentLocationContext"; |
|
|
import { CurrentLocationContext } from "../context/CurrentLocationContext"; |
|
|
import attachFocusToQuery from "../hooks/useFocus"; |
|
|
import attachFocusToQuery from "../hooks/useFocus"; |
|
|
import {MapMarkerList} from "../components/MapMarkerList"; |
|
|
import {MapMarkerList} from "../components/MapMarkerList"; |
|
|
|
|
|
|
|
|
export default function MapFeedScreen() { |
|
|
export default function MapFeedScreen() { |
|
|
const [position, setPosition] = useState(null); |
|
|
|
|
|
|
|
|
|
|
|
const context = useContext(CurrentLocationContext); |
|
|
|
|
|
const location = context.currentCoordinates; |
|
|
|
|
|
const focusChanged = attachFocusToQuery(); |
|
|
const focusChanged = attachFocusToQuery(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
setPosition({ |
|
|
|
|
|
lat: location["latitude"], |
|
|
|
|
|
long: location["longitude"], |
|
|
|
|
|
zoom: 16.5, |
|
|
|
|
|
}); |
|
|
|
|
|
}, [location]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<View style={styles.container}> |
|
|
<View style={styles.container}> |
|
|
<OpenStreetMap |
|
|
<OpenStreetMap |
|
|
markersList={MapMarkerList({reload:focusChanged, renderRain:true})} |
|
|
markersList={MapMarkerList({reload:focusChanged, renderRain:true})} |
|
|
// animateToPosition={position}
|
|
|
|
|
|
centerUserLocation={true} |
|
|
centerUserLocation={true} |
|
|
|
|
|
focusChanged={focusChanged} |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
</View> |
|
|
</View> |
|
|