@ -8,6 +8,7 @@ import {
goToRegion ,
} from "./LeafLetMap" ;
import MapModal from "../MapModal" ;
import { useLocation , getLocation } from "../../hooks/useLocation" ;
function bindEventsToListeners (
event ,
@ -36,7 +37,6 @@ function notEmpy(lista) {
export default function OpenStreetMap ( {
markersList ,
animateToPosition ,
clickListener ,
moveEndListener ,
} ) {
@ -44,12 +44,10 @@ export default function OpenStreetMap({
const [ webviewContent , setWebviewContent ] = useState ( null ) ;
const [ markerListener , setMarkerListener ] = useState ( null ) ;
useEffect ( ( ) => {
if ( mapRef != null ) {
goToRegion ( mapRef , animateToPosition ) ;
}
} , [ mapRef , animateToPosition ] ) ;
const viewFunction = ` \
setCustomView ( $ { global . location . lat } , $ { global . location . long } , 16.5 ) ; ` ;
console . log ( global . location )
markersList &&
mapRef &&
notEmpy ( markersList ) &&
@ -77,6 +75,7 @@ export default function OpenStreetMap({
} }
javaScriptEnabled = { true }
source = { { html : webviewContent } }
injectedJavaScript = { viewFunction }
/ >
< View >
< MapModal
@ -85,25 +84,8 @@ export default function OpenStreetMap({
markers = { markersList }
/ >
< / V i e w >
< View style = { styles . callback } >
< Text style = { styles . txt } > { markerListener } < / T e x t >
< / V i e w >
< / V i e w >
) ;
}
const styles = StyleSheet . create ( {
callback : {
position : "absolute" ,
top : 30 ,
alignSelf : "center" ,
alignItems : "center" ,
backgroundColor : "gray" ,
width : "80%" ,
padding : 10 ,
} ,
txt : {
color : "white" ,
} ,
} ) ;
xxxxxxxxxx