-
Notifications
You must be signed in to change notification settings - Fork 855
Add prop onTilesLoaded
#615
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
Add prop onTilesLoaded
#615
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, left a couple of comments
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "google-map-react", | |||
"version": "1.0.5", | |||
"name": "@jfw/google-map-react", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets remove the @jfw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that. I needed to publish the component in order to use it in a project. I'll remove it on master
.
package.json
Outdated
"name": "google-map-react", | ||
"version": "1.0.5", | ||
"name": "@jfw/google-map-react", | ||
"version": "1.0.6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets not make a version from this PR, version will be bumped when necessary with one or multiple PRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
API.md
Outdated
@@ -138,6 +138,8 @@ When the user changes the map type (HYBRID, ROADMAP, SATELLITE, TERRAIN) this fi | |||
#### onGoogleApiLoaded (func) | |||
Directly access the maps API - *use at your own risk!* | |||
|
|||
#### onTilesLoaded (func) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the info?
I've applied all changes, please have another look @itsmichaeldiego. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work man! I just left a very minor comment, looking forward to merge this asap.
CHANGELOG.md
Outdated
@@ -1,5 +1,8 @@ | |||
Add [google-map-clustering-example](https://github.com/istarkov/google-map-clustering-example) | |||
|
|||
###[Unreleased] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathanweiss Can we move this section to the bottom? And also, no need of add Unreleased
as I am going to release it very soon after merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, I've removed that header. Not sure if I understand you correctly: you want me to move the entries for unreleased things to the bottom of the change log file?
Can you delete the latest commit? Only the maintainers set the version releases |
src/google_map.js
Outdated
@@ -663,6 +662,10 @@ export default class GoogleMap extends Component { | |||
this.heatmap.setMap(map); | |||
} | |||
|
|||
maps.event.addListener(map, 'tilesloaded', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add the listener all the times, or only when the user has set an onTilesLoaded prop? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I thought that this is just a micro optimisation, but this event is triggered a lot when the user is changing the viewport of the map. So it makes sense not to listen to the event if we don't need to. 👍
@jonathanweiss Changes are looking great now! Thank you, I left a question for you before we merge this. |
Now we don't need |
@jonathanweiss What do you mean by that we don't need it any longer? |
Well, all that it does is checking if |
@jonathanweiss This is fine like this, thanks though! |
Can someone please update the typescript definition to match as I could really do with the onTilesLoaded event. https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/google-map-react/index.d.ts |
@jsharland Type Definition are now up2date. |
* 'master' of github.com:google-map-react/google-map-react: Bump to 1.1.1 (google-map-react#680) Revert "Added feature: update heat map on data change + fix linting" (google-map-react#679) Bump version to 1.1.0 (google-map-react#671) Added feature: update heat map on data change + fix linting (google-map-react#593) Pass map instance to onDrag handler (google-map-react#656) add math abs to avoid negative values when calculating zoom (google-map-react#655) Bump version to 1.0.9 (google-map-react#651) Custom div style options (google-map-react#634) Bump version to 1.0.8 (google-map-react#646) Revert 643 fix/map context (google-map-react#645) Bump version to 1.0.7 (google-map-react#644) Add passive scroll (google-map-react#631) Use React 16 portal to render map overlay (google-map-react#643) Fix old examples links and add one to new examples (google-map-react#633) Bump version to 1.0.6 (google-map-react#621) Add prop `onTilesLoaded` (google-map-react#615) Fix typo, and call fromContainerPixelToLatLng() as you would expect. (google-map-react#620) Update API.md (google-map-react#611) Upgrade version to 1.0.5 (google-map-react#607) Remove marker jiggle. (google-map-react#603)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
There are some events that are fired by the Google Maps JavaScript API, but there are not available on the React component. With this PR, I'm passing through the event
tilesloaded
.Please let me know what you think about this. I'd love to see my changes upstream.