|
|
@ -1,6 +1,5 @@ |
|
|
|
import React, { useContext, useState } from "react"; |
|
|
|
import { StyleSheet, View, Text, Image } from "react-native"; |
|
|
|
import MapView from "react-native-maps"; |
|
|
|
|
|
|
|
import colors from "../config/colors"; |
|
|
|
import { screen_width, screen_height } from "../config/dimensions"; |
|
|
@ -17,9 +16,6 @@ const MapFormScreen = (props) => { |
|
|
|
const context = useContext(EventLocationContext); //local do evento
|
|
|
|
const contextLocation = useContext(CurrentLocationContext); //local do usuário
|
|
|
|
|
|
|
|
const [marker, setMarker] = useState(context.eventCoordinates); |
|
|
|
|
|
|
|
|
|
|
|
const [moveEndListener, setMoveEndListener] = useState(""); |
|
|
|
console.log(moveEndListener); |
|
|
|
|
|
|
@ -55,36 +51,19 @@ const MapFormScreen = (props) => { |
|
|
|
latitudeDelta: 70, |
|
|
|
longitudeDelta: 70 * (screen_width / screen_height), |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
<View style={styles.container}> |
|
|
|
<OpenStreetMap |
|
|
|
style={styles.mapStyle} |
|
|
|
moveEndListener={setMoveEndListener} |
|
|
|
/> |
|
|
|
{/*<MapView |
|
|
|
style={styles.mapStyle} |
|
|
|
showsUserLocation={true} |
|
|
|
initialRegion={{ ...default_location }} |
|
|
|
region={{ |
|
|
|
latitude: marker.latitude, |
|
|
|
longitude: marker.longitude, |
|
|
|
...lat_long_delta, |
|
|
|
}} |
|
|
|
onRegionChangeComplete={(r) => { |
|
|
|
// console.log(r);
|
|
|
|
setMarker({ latitude: r.latitude, longitude: r.longitude }); |
|
|
|
}} |
|
|
|
/>*/} |
|
|
|
{/*<View style={styles.markerFixed}> |
|
|
|
<View style={styles.markerFixed}> |
|
|
|
<Image |
|
|
|
style={styles.marker} |
|
|
|
resizeMode="contain" |
|
|
|
source={require("../assets/map-marker.png")} |
|
|
|
/> |
|
|
|
</View>*/} |
|
|
|
</View> |
|
|
|
|
|
|
|
<View style={styles.submit_btn}> |
|
|
|
<TouchableOpacity onPress={() => setLocation()}> |
|
|
@ -107,9 +86,12 @@ const styles = StyleSheet.create({ |
|
|
|
container: { |
|
|
|
backgroundColor: colors.black, |
|
|
|
flex: 1, |
|
|
|
justifyContent: "center", |
|
|
|
flexDirection: "row" |
|
|
|
}, |
|
|
|
mapStyle: { |
|
|
|
position: "absolute", |
|
|
|
alignSelf:"center", |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
right: 0, |
|
|
@ -126,15 +108,19 @@ const styles = StyleSheet.create({ |
|
|
|
textAlign: "center", |
|
|
|
}, |
|
|
|
markerFixed: { |
|
|
|
left: "50%", |
|
|
|
marginLeft: -19, |
|
|
|
marginTop: -48, |
|
|
|
alignItems:"center", |
|
|
|
//left: "50%",
|
|
|
|
// marginLeft: -19,
|
|
|
|
// marginTop: -48,
|
|
|
|
alignSelf: "center", |
|
|
|
justifyContent: "center", |
|
|
|
position: "absolute", |
|
|
|
bottom: "50%", |
|
|
|
top:"50%", |
|
|
|
height: "20%", |
|
|
|
flexDirection:"row", |
|
|
|
alignItems:"flex-start", |
|
|
|
// bottom: "50%",
|
|
|
|
// top: "50%",
|
|
|
|
height: "13%", |
|
|
|
width: 38, |
|
|
|
//backgroundColor: "black"
|
|
|
|
}, |
|
|
|
text: { |
|
|
|
color: colors.white, |
|
|
@ -143,9 +129,9 @@ const styles = StyleSheet.create({ |
|
|
|
fontWeight: "bold", |
|
|
|
}, |
|
|
|
marker: { |
|
|
|
height: "40%", |
|
|
|
alignSelf:"center", |
|
|
|
width: 38, |
|
|
|
height: "50%", |
|
|
|
// alignSelf:"flex-end",
|
|
|
|
width: 40, |
|
|
|
}, |
|
|
|
callback: { |
|
|
|
bottom: 100, |
|
|
|