Open ankur1163 opened 1 year ago
import MapView, { Marker } from "react-native-maps"; import { useEffect, useRef } from "react"; import React from "react"; import { StyleSheet } from "react-native"; import MapViewDirections from "react-native-maps-directions"; export default function Navigation() { const origin = { latitude: 37.3318456, longitude: -122.0296002 }; const destination = { latitude: 37.771707, longitude: -122.4053769 }; const GOOGLE_MAPS_APIKEY = "mykey";
return ( <MapView initialRegion={{ latitude: origin.latitude, longitude: origin.longitude, latitudeDelta: 0.005, longitudeDelta: 0.005, }}
<MapViewDirections origin={origin} destination={destination} apikey={GOOGLE_MAPS_APIKEY} /> ); } I have very simple code and i see nothing on screen, no map nothing. https://prnt.sc/SyoQ6ynnLQJQ
I believe that MapView must been inside View.
import MapView, { Marker } from "react-native-maps"; import { useEffect, useRef } from "react"; import React from "react"; import { StyleSheet } from "react-native"; import MapViewDirections from "react-native-maps-directions"; export default function Navigation() { const origin = { latitude: 37.3318456, longitude: -122.0296002 }; const destination = { latitude: 37.771707, longitude: -122.4053769 }; const GOOGLE_MAPS_APIKEY = "mykey";
return ( <MapView initialRegion={{ latitude: origin.latitude, longitude: origin.longitude, latitudeDelta: 0.005, longitudeDelta: 0.005, }}