@ -9,6 +9,7 @@ import * as Location from "expo-location";
import { EventLocationContext } from "../context/EventLocationContext" ;
import { TouchableOpacity } from "react-native-gesture-handler" ;
import { CurrentLocationContext } from "../context/CurrentLocationContext" ;
import OpenStreetMap from "../components/map/OpenStreetMap" ;
// NOTE: Implementação posterior: É interessante adcionar um searchBox para que o usuário busque um endereço (google places autocomplete é uma api paga)
@ -18,6 +19,10 @@ const MapFormScreen = (props) => {
const [ marker , setMarker ] = useState ( context . eventCoordinates ) ;
const [ moveEndListener , setMoveEndListener ] = useState ( "" ) ;
console . log ( moveEndListener ) ;
const getAddress = async ( coordenadas ) => {
Location . setGoogleApiKey ( "AIzaSyD_wuuokS3SVczc8qSASrsBq0E5qIpdyMc" ) ;
@ -34,7 +39,7 @@ const MapFormScreen = (props) => {
} ;
const setLocation = ( ) => {
getAddress ( mark er ) ;
getAddress ( moveEndListen er ) ;
props . navigation . goBack ( null ) ;
} ;
@ -51,9 +56,15 @@ const MapFormScreen = (props) => {
longitudeDelta : 70 * ( screen_width / screen_height ) ,
} ;
return (
< View style = { styles . container } >
< MapView
< OpenStreetMap
moveEndListener = { setMoveEndListener }
/ >
{ / * < M a p V i e w
style = { styles . mapStyle }
showsUserLocation = { true }
initialRegion = { { ... default_location } }
@ -66,14 +77,14 @@ const MapFormScreen = (props) => {
// console.log(r);
setMarker ( { latitude : r . latitude , longitude : r . longitude } ) ;
} }
/ >
< View style = { styles . markerFixed } >
/>*/ }
{ / * < V i e w s t y l e = { s t y l e s . m a r k e r F i x e d } >
< Image
style = { styles . marker }
resizeMode = "contain"
source = { require ( "../assets/map-marker.png" ) }
/ >
< / V i e w >
< /View>*/ }
< View style = { styles . submit_btn } >
< TouchableOpacity onPress = { ( ) => setLocation ( ) } >
@ -116,12 +127,14 @@ const styles = StyleSheet.create({
} ,
markerFixed : {
left : "50%" ,
marginLeft : - 24 ,
marginLeft : - 19 ,
marginTop : - 48 ,
alignItems : "center" ,
position : "absolute" ,
bottom : "50%" ,
top : "50%" ,
height : 48 ,
width : 4 8,
height : "20%" ,
width : 3 8,
} ,
text : {
color : colors . white ,
@ -130,8 +143,17 @@ const styles = StyleSheet.create({
fontWeight : "bold" ,
} ,
marker : {
height : 48 ,
width : 48 ,
height : "40%" ,
alignSelf : "center" ,
width : 38 ,
} ,
callback : {
bottom : 100 ,
alignSelf : "center" ,
alignItems : "center" ,
backgroundColor : "gray" ,
width : "80%" ,
padding : 10 ,
} ,
} ) ;