You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
1.3 KiB

import React from "react";
import { StyleSheet, View } from "react-native";
import MapView from "react-native-maps";
import colors from "../config/colors";
import useLocation from "../hooks/useLocation";
import useMarkers from "../hooks/selectFromDB";
import MapMarker from "../components/MapMarker";
function MapFeedScreen(props) {
const location = useLocation({
latitude: -22.1070263,
longitude: -51.3948396,
});
const markers = useMarkers();
return (
<View style={styles.container}>
<MapView
style={styles.mapStyle}
initialRegion={{
latitude: -22.1070263,
longitude: -51.3948396,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
region={{
latitude: location["latitude"],
longitude: location["longitude"],
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
>
{[...markers.markers].map(({ ID, ...val }) => {
return <MapMarker key={ID.toString()} {...val} />;
})}
</MapView>
</View>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: colors.black,
flex: 1,
},
mapStyle: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
},
});
export default MapFeedScreen;