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

Feature/map on load #156

Closed
wants to merge 2 commits into from
Closed

Conversation

mbahoshy
Copy link

onLoad prop for map component. useful for setting event listeners on map object

@tomchentw
Copy link
Owner

Sorry, I'm doing a refactoring at the moment. Would you consider raise this again afterwards? Some review comments:

  1. don't compile lib, I'll do it for you
  2. what kind of event listeners do you need that is not supported by react-google-maps currently?

@tomchentw
Copy link
Owner

#157 is landed. Would you consider revisit this again?

Actually I'm not a big fan of exposing google map object to the outside. It may lead to misuse of the object and lose the advantage of using React.

@mbahoshy
Copy link
Author

@tomchentw I was trying to set an event listener for "center_changed" on the map object. Is there currently a way to do this? The callback is nice because it lets you add any logic that may need to take place once the map has been created.

@tomchentw
Copy link
Owner

@mbahoshy the center_changed is supported and you can set it via props.onCenterChanged on the <GoogleMap> component.
https://github.com/tomchentw/react-google-maps/blob/master/src/eventLists/GoogleMapEventList.js#L5

See Geojson example for using onZoomChanged:
https://tomchentw.github.io/react-google-maps/#geojson

tomchentw added a commit that referenced this pull request Nov 24, 2015
@mbahoshy
Copy link
Author

@tomchentw thanks exactly what I am looking for, I missed this feature. I could still see the virtue of an onLoad function, maybe w/o map object in callback.

@tomchentw
Copy link
Owner

You don't need onLoad after #157 is landed with callback refs. At the time the callback is invoked, the component is initialized and loaded.

@tomchentw tomchentw closed this Nov 25, 2015
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

Successfully merging this pull request may close these issues.

3 participants