Questions tagged [react-google-maps-api]
93 questions
0
votes
1 answer
useLoadScript libraries show error with different values?
const libraries = ['drawing', 'places', 'geometry'];
const {isLoaded, loadError } = useLoadScript({ googleMapsApiKey: '',
libraries: libraries })

Mostafa Yasser
- 145
- 1
- 2
- 7
0
votes
2 answers
Map Marker don't show up (Marker rendered before Map)- ReactJS with @react-google-maps/api
What I want:
Having a Default ReactJS App with a Google Map
Problem:
Marker don't display
Possible reason:
Marker been added before map finish load.
Files:
App.js, (Default ReactJS file)
Map.js, (Customized ReactJS…

Yanze-Sun-Li
- 1
- 4
0
votes
1 answer
react-google-maps/api Remove need to hold ctrl to zoom
I've setup a map in my react app with react-google-maps/app, but there's something that's annoying me. To zoom the map with the scroll wheel, you have to hold down the control key. Is there a way I can disabled this so that I can zoom without…

Nick
- 85
- 8
0
votes
1 answer
I can't set the state in my handler function
I'm trying to set a const of my state but it seems that don't work when a few days ago it worked.
I call the setter in a function like this:
const [activeMarker, setActiveMarker] = useState(null);
const handleActiveMarker = (marker) => {
if…

JudiithGV
- 56
- 7
0
votes
1 answer
Pass an array when it changes from parent to child
I'm trying to get with nearbySearch from Google Maps API the places that are near to me and send this data to my child component for put markers in map.
This is the function where I call Google Service Nearby Search and it prints the correct data in…

JudiithGV
- 56
- 7
0
votes
0 answers
When I call to google.maps.services, my map desappears
I'm using ReactJS and react-google-maps/api to make my application that calls to my backend and google API.
I add a few markers to the map and when I click on them, I call the google API to get the details of that establishment according to its…

JudiithGV
- 56
- 7
0
votes
0 answers
TypeError: Cannot read properties of undefined (reading 'maps')
I am trying to use the DistanceMatrixService from @react-google-maps/api. One of the required parameters is the 'travelMode'. However, when I tried setting 'travelMode' to 'DRIVING', it shows the following!
I tried doing
travelMode:…

nicole
- 1
- 1
0
votes
0 answers
TypeError: undefined is not an object (evaluating 'stateText.length')
I am using react-native-google-places-autocomplete for a filter menu on a project. While I am inputting text into the object I want to track the text input with a state variable called 'address'. To do that I used a…

Edward Silva
- 1
- 1
- 2
0
votes
1 answer
React Google Map Fitbounds not a function error
Whenever I use map.fitbound I get a Uncaught TypeError: map.fitBounds is not a function.
The important code snippet:
var bounds = new google.maps.LatLngBounds();
const map = useRef(null);
const getMarkers = (inPins) => {
return inPins.map((pin,…

Lucy Gu
- 369
- 1
- 3
- 10
0
votes
1 answer
@react-google-maps/api can't print polygon
why i can't print the polygon when i using library @react-google-maps/api ?
when i make it as pdf the data goes in, but when i click dowload which code like this
const print =() => {
var printContents =…

Dicka Reynaldi
- 329
- 2
- 11
0
votes
0 answers
ESLint: Unsafe assignment of an `any` value with @react-google-maps/api and TypeSscript
I'm implementing a draggable marker with @react-google-maps/api, so I create a controllable state using useState. However, when I create a handleMarkerDrag function, TypeScript complains about the any type, despite all params and returns being…

mikemykhaylov
- 91
- 1
- 9
0
votes
1 answer
React get value from a class
I have a component where i get the distance from one point to another, with Google Maps (DirectionsRenderer).
What i want, is to use this data in a h1
directionsRenderer.directions.routes[0].legs[0].distance.text;
This is my return
return (
…

mky
- 85
- 1
- 9
0
votes
1 answer
React google maps/api: How to focus on the marker position with zoom based on search results?
I need to focus on the marker based on dynamic search results. As far as I understood from other discussions, what I need is to make a use of panTo function.
I gave a try, and it works partially.
Here is the code example and the codesandbox…

FD3
- 1,462
- 6
- 24
- 47
-1
votes
0 answers
how to edit a polygon in google map using react-google-map/api in a react app
I have got a react app which have some polygon. I can draw new polygon in app and can save its all vertex lag,lng in a variable but when I try to edit it i can't see any changes in my polygons but only reflecting in map not in variable like…
-1
votes
1 answer
Why on set state in react throws Cannot read properties of null (reading 'toString')?
I'm using React Google Maps API, and every time that I run this function, when drag end a marker it throws the exception Cannot read properties of null (reading 'toString') if I try to run the setSelectedBusPoint() and setAdjacenteBusPoint()…

JHOSEF NASCIMENTO
- 29
- 6