Skip to content
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

Unable to access map reference in v6+ #545

Closed
xveganxxxedgex opened this issue Jul 18, 2017 · 10 comments
Closed

Unable to access map reference in v6+ #545

xveganxxxedgex opened this issue Jul 18, 2017 · 10 comments

Comments

@xveganxxxedgex
Copy link

SO post: https://stackoverflow.com/questions/44296040/accessing-map-reference-using-react-google-maps-v6

Is there a good way to get the internal map reference to be able to add custom labels and other extended logic?

Thank you!

@oshalygin
Copy link
Collaborator

#161 (comment)

Is the current solution, but we have plans to add something a bit more elegant.

@nzoLogic
Copy link

I'm still a bit confused how to implement adding custom control divs to the map through this reference. I'm trying to create something similar to how [google maps] (https://www.google.com/maps/@37.7832535,-122.4297368,15z) display results once you type in "food". Could you provide an example how to do this using react-google-maps?

@oshalygin
Copy link
Collaborator

@nzoLogic the MAP constant gives you a reference to the map object.

https://developers.google.com/maps/documentation/javascript/examples/marker-labels
Gives details on how to add marker-labels

In regards to your last question, you mean the markers that are generated from google maps when you search?

image

@nzoLogic
Copy link

@oshalygin I understand how to render the markers and info windows. I want to add the left container underneath the search bar that displays the results in a list like in the picture you posted, but can't figure out how to add it to the map.

Did that help clarify my last question?

@nzoLogic
Copy link

nzoLogic commented Jul 21, 2017

@oshalygin I've been able to get an instance of the map component using a ref function but can't for the life of me figure out how to add my own elements to the map

@oshalygin
Copy link
Collaborator

oshalygin commented Jul 24, 2017

@oshalygin I understand how to render the markers and info windows. I want to add the left container underneath the search bar that displays the results in a list like in the picture you posted, but can't figure out how to add it to the map.

Did that help clarify my last question?

Yeah I get what you're saying, thats not supported with this library at this time. Maybe in the future one we get some of the bigger items tackled.

You'll notice that certain aspects from Google Maps don't carry over to the API and you'd have to build them out manually. You can definitely use the Places API to query for the data and get the results, it'll just come back to you in the form of JSON that you then have to build out and display.

@oshalygin
Copy link
Collaborator

@oshalygin I've been able to get an instance of the map component using a ref function but can't for the life of me figure out how to add my own elements to the map

You mean markers? Just use the <Marker /> component

@nzoLogic
Copy link

nzoLogic commented Aug 1, 2017

Thanks for your help @oshalygin. Do you guys need help with contributions? I haven't contributed to open source projects yet, but want to help out!

@oshalygin
Copy link
Collaborator

Always looking for contributors!

@nzoLogic
Copy link

nzoLogic commented Aug 1, 2017 via email

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants