Questions tagged [react-google-maps]

Questions regarding Reactjs component for google maps by tomchentw.

Questions regarding Reactjs component for google maps by tomchentw. https://github.com/tomchentw/react-google-maps.

462 questions
4
votes
1 answer

react-google-maps how does one get marker position?

I read the docs and it conveniently outlines the props and methods available. Please look here. My question is, given the example component here: import {withScriptjs, withGoogleMap, GoogleMap, Marker} from "react-google-maps"; class…
Philll_t
  • 4,267
  • 5
  • 45
  • 59
4
votes
2 answers

react-google-maps: how to use fitBounds, panBy, panTo, panToBounds public APIs?

According to the React Google Maps library, you can call these four methods from the ref object. What seems weird, is that these methods are supposed to receive two parameters, a map instance and other arguments, like so: fitBounds(map, args) {…
Dan H
  • 3,524
  • 3
  • 35
  • 46
3
votes
2 answers

Trying to animate markers movement with react-google-maps smoothly

I'm trying to animate my google maps markers like this... Example of markers animated movement And i tried to replicate this code into react (using, @react-google-maps/api), but couldn't make it work, i'm having multiple problems, number one, would…
Diego
  • 421
  • 3
  • 9
  • 34
3
votes
1 answer

The most proper way to solve "Remove unused Javascript" from Lighthouse for Google Recaptcha and Google Maps API

I'm working on a React webpage using the Gatsby framework and I'm doing continuous deployment using AWS while I get a good page speed value. One of the improvement opportunities is Remove unused Javascript and it explains this: Sorry, follow this…
juansedo
  • 46
  • 1
  • 4
3
votes
1 answer

Marker with label from google map doen't have event target

I'm trying to add onclick event to Marker my code looks like this:
3
votes
0 answers

@react-google-maps/api very slow when load thousand markers & markerClusterer

how to load markers properly? cause when i load thousand markers around 123.xxx from API it's slowing down my browser, all of the markers were loaded successfully but it's really slow on performance. im using this package :…
3
votes
5 answers

react-google-maps/api DirectionsService keeps rerendering itself

I have written this code in react JS to using "react-google-maps/api" to calculate route between two points. Now my google map keeps rerendering itself until it gives "DIRECTIONS_ROUTE: OVER_QUERY_LIMIT" error. I don't know what's the issue. Help…
3
votes
1 answer

how to make fixed marker in center of google map in react?

I have react app using react-google-maps. I want it to have marker fixed at the center of map when user moves the map. But in my case, whenever dragging event happens map is just immediately refreshed. parent component: import React, { useState,…
김민겸
  • 75
  • 2
  • 8
3
votes
1 answer

Getting lat/lng from google map using react-google-maps

I have my map component const MyMapComponent = withScriptjs( withGoogleMap(props => ( console.log(e)} > …
Mehmood
  • 109
  • 2
  • 12
3
votes
0 answers

React js google map @react-google-maps/api add marker Too many re-renders. React limits the number of renders to prevent an infinite loop

I have a map where I have to add places for certain cameras, so each camera manages specific points. When I add the cameras no problem, but when I add the specific points, for the room I get the following problem. Nothing changes, between adding a…
Paul
  • 3,644
  • 9
  • 47
  • 113
3
votes
1 answer

How to set form value while using google map with ant design Form.Item?

I have created a custom component (wrapper for react-google-map) which returns the latitude, longitude and zoomlevel on onClick event of the GoogleMap component. Now I want to wrap it up with the ant.design Form.Item component with the…
acesmndr
  • 8,137
  • 3
  • 23
  • 28
3
votes
0 answers

How to remove all markers without any side effect in react-google-map?

I am working with react-google-maps component. Since I have a lot of markers to be shown on the google map, I used MarkerClusterer. I can select or deselect rows in the ag-grid table to make the marker shown on react-google-map. If I select all, all…
3
votes
0 answers

jest - Cannot find module (3rd party library)

I setup jest according to the setup guide on the docs (though i'm getting this issue when using create-react-app so I don't think it's related to jest config) In one of my tests i'm importing components from the @react-google-maps/api library (which…
Uri Klar
  • 3,800
  • 3
  • 37
  • 75
3
votes
2 answers

React google maps re-render issue using onBoundsChanged

I've got a project i'm working on where I use react google maps, however I've run into an issue where when I get the onBoundsChanged event and set state in the callback, it goes into a permanent loop of re rendering. I can only assume somehow that…
Batzz
  • 422
  • 4
  • 12
3
votes
1 answer

google.maps.places.PlacesService(map) always returns null

Am trying to fetch nearby restaurants using google maps API with react-google-maps. import React from 'react'; import { compose, withState, withProps, withStateHandlers, lifecycle } from 'recompose'; import { withScriptjs, withGoogleMap, GoogleMap,…