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
2
votes
2 answers

react-google-maps click the map to get coordinates

I'm new to react-google-maps and I want to add an eventlistener to the map such that when I click any point on the map, I can get the coordinate of that point, however, I really don't know where I should add the event Listener. Snippets of my code…
Leslie Pu
  • 21
  • 1
  • 2
2
votes
1 answer

onCenterChange callback returns undefined @react-google-maps/api

I have been using a library called @react-google-maps/api and I want to store the map center as react state and I want the user to be able to drag the map while the marker always stays at the center of the map (uber style location selection) The…
Malik Bagwala
  • 2,695
  • 7
  • 23
  • 38
2
votes
0 answers

How to test GoogleMap using jest

I'm developing a react application using react-google-maps npm's compontent. How should i add testing to this component? I need to develop some testing over the map but when i try to render it using jest, the shallow only returns the container…
Kuro
  • 21
  • 1
2
votes
1 answer

react-google-maps fitBounds and panToBounds does not scale the map

const Map = withGoogleMap(props => { const { activeMarker, zoom, center, showInfoWindow, products } = props; const [selectedPlace, setSelectedPlace] = useState(null); // Iterate items to size, center, and zoom map to contain all markers …
ash1f
  • 89
  • 2
  • 8
2
votes
1 answer

Prevent React Google Maps from jumping to the center of the page when opening InfoWindow

When I click on the map icon and open the info window the page jumps to the center of my screen. How can i prevent the page from jumping when i open an info window? const UserMarker = props => (
Chris G
  • 21
  • 2
2
votes
1 answer

Reactjs web app google maps working on PC localhost but not on mobile

My web app made on react has been working wonders on the PC, but I recently noticed that when I open the same app from the localhost:3000 on my phone it doesn't open. As I mentioned it is a react app, so some of it's components load for instance in…
2
votes
2 answers

Render google maps OverlayView centered on location

I need to render a button centered over a specific location, right now I'm using an OverlayView to render the button.
Eugene
  • 10,006
  • 4
  • 37
  • 55
2
votes
1 answer

this.props.children is not a function when trying to cluster markers from array using @react-google-maps

I'm trying to take an array of objects with lat/long points and create a Marker for each, and then pass those Markers into a component. By copying straight off the docs here I can make it work. However, their approach is a bit…
colemars
  • 979
  • 3
  • 12
  • 25
2
votes
1 answer

react-google-maps Module not found: Can't resolve 'react-google-maps/lib/places/SearchBox'

I have a create-react-app which uses react-google-maps. What I want to do is to import SearchBox from 'react-google-maps/lib/places/SearchBox' but I'm getting the following error: Module not found: Can't resolve…
Nazar
  • 21
  • 2
  • 5
2
votes
1 answer

How to set zoom control option?

using react-google-maps, my following option for changing the position of zoom is not working
Gaurav Kumar
  • 1,111
  • 6
  • 25
  • 52
2
votes
2 answers

Why map re rendering on marker click event?

I have google map with multiple markers with the cluster. Upon marker click, I am showing info window, but when I click on marker whole of the map marker and cluster are re-rendered, which makes the page slow and annoying. Following is my…
Gaurav Kumar
  • 1,111
  • 6
  • 25
  • 52
2
votes
1 answer

How to make marker always centered when map is moving around?

I am using react-google-maps component to make map with one marker. I did it and it is working perfectly, but the problem is that I want that marker will be always centered. I did research on google, and find out several solutions: one is by google…
Romanas
  • 547
  • 7
  • 25
2
votes
1 answer

Why react-google-maps rendering one Circle component twice?

When I added react-google-maps to project, render worked twice. So I have 2 circles one under another. Also, I display the center coordinates by onDragEnd() method. This event works for only one of this circles. Any others google maps dosen`t…
VladaNak
  • 21
  • 1
2
votes
0 answers

Create and add style map type with react-google-maps

I would like to have a satellite, a roadmap and a custom-map map styles button menu available. I tried to follow those google api guide lines: https://developers.google.com/maps/documentation/javascript/styling#creating_a_styledmaptype And apply…
louis amoros
  • 2,418
  • 3
  • 19
  • 40
2
votes
1 answer

How do you search within a Polygon's coordinates on Google Maps?

I have implemented react-google-maps with the . Not sure how to use the object it returns from onPolylineComplete though. Doesn't seem to be documented either. I want to check some other locations appear in the area - so I can…
Aid19801
  • 1,175
  • 1
  • 17
  • 30