-
-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow InfowWindow anchor to be a <Marker/> component #10
Comments
Hi, I'm trying to make a Circle marker with a InfoWindow popup. Any documentation or example about it? Many thanks in advance |
Hi @grdpr, P.S. Any reason you want to use an InfoWindow instead of an OverlayView? InfoWindow gives you some default styles you can't control and also the X close button that closes it without going through react |
Thanks @uriklar! I'll give a try to render a list of markers with this InfoWindow and also with OverlayView to feel the difference. OverlayView isn't include in the API from GoogleMaps right? |
Included indeed: https://developers.google.com/maps/documentation/javascript/reference/overlay-view#OverlayView |
Thanks for all this work! |
Not sure what you mean by "wrapper" but almost every component exposes an onClick event handler |
@uriklar the onClick event handler works well on the map! |
Do you want to share a codesandbox? |
here it is: https://codesandbox.io/s/l2jn4xm9yl |
@grdpr https://codesandbox.io/s/l2jn4xm9yl returns 404. |
how do we pass the anchor |
@tdotholla I didn't quite understand what you're asking |
No problem. it was explained better by @FredyC here (#18 (comment)) I think also you guys implemented his suggestions or pull requests... so i can hop off of this thread. Also i don't use "anchor" parameter and my infowindow is nested outside or Marker tags... not sure if that helps but it's working great for me with InfoWindow just having "position" parameter. |
published 1.2.3-alpha.1 |
@tdotholla please test |
Is this still open? There are error messages (infoWindow.tsx line 79) that indicate the component is expected to be rendered inside a Marker, but it doesn't look like the code is there to do this yet??? |
@uriklar please look at this issue, I have no time today |
@hswope-arcweb The error message on line 79 is only triggered if there's no anchor or position property defined. There currently is anchor support, but it's not very usable. It requires you to pass in a google Marker object (as opposed to a component which would be a much nicer behaviour) Instead of using an anchor, i'd go with the approach detailed in this sandbox: |
@uriklar Thanks for the reply. That makes sense. I ended up going with an OverlayView for my implementation anyway, which had its own challenges associating it (visually) with a marker. If time allows, I was thinking of adding some functionality to the OverlayView component and putting in a PR. In general, I like this library. Although new, it is tight and clean. Thanks for your work. |
@hswope You are welcome! |
You can pass offset to InfoWindow Where the first is left offset and the second number is top/bottom offset. You might need to experiment a little, but in my case it was My icon looks like
|
Just to clarify, does this issue mean that this does not work: In my attempts at putting InfoWindow inside a Marker, I get that error: I would rather not hack about passing markers into my InfoWindow manually, or setting position, so I am tempted to try and fix this in a PR, provided I'm understanding the issue right? |
Hi! Any idea how to open an InfoWindow? This is what I am looking for: https://developers.google.com/maps/documentation/javascript/infowindows#open |
I am new-ish to react and google maps, but I just nudged my infowindows up using negative margin so they aren't covering the markers. I have the infowindows and markers using the same lat, long position.
|
Right now supports only position property
The text was updated successfully, but these errors were encountered: