Title: I was not able to get onClick event on Marker · Issue #512 · fullstackreact/google-maps-react · GitHub
Open Graph Title: I was not able to get onClick event on Marker · Issue #512 · fullstackreact/google-maps-react
X Title: I was not able to get onClick event on Marker · Issue #512 · fullstackreact/google-maps-react
Description: I was tried to get the onClick event on the marker but I'm not able to get that. I was going through the document also I was created the static position and marker still it's not getting it. can someone help me? `import { Map, InfoWindow...
Open Graph Description: I was tried to get the onClick event on the marker but I'm not able to get that. I was going through the document also I was created the static position and marker still it's not getting it. can so...
X Description: I was tried to get the onClick event on the marker but I'm not able to get that. I was going through the document also I was created the static position and marker still it's not getting it...
Opengraph URL: https://github.com/fullstackreact/google-maps-react/issues/512
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"I was not able to get onClick event on Marker","articleBody":"I was tried to get the onClick event on the marker but I'm not able to get that. I was going through the document also I was created the static position and marker still it's not getting it. can someone help me?\r\n`import { Map, InfoWindow, Marker, GoogleApiWrapper } from \"google-maps-react\";\r\nimport React, { Component } from \"react\";\r\n\r\n```\r\nclass WithMarkers extends Component {\r\n state = {\r\n activeMarker: {},\r\n selectedPlace: {},\r\n showingInfoWindow: false\r\n };\r\n\r\n onMarkerClick = (props, marker) =>\r\n this.setState(\r\n {\r\n activeMarker: marker,\r\n selectedPlace: props,\r\n showingInfoWindow: true\r\n },\r\n () => {\r\n console.log(\"Click on marker\");\r\n }\r\n );\r\n\r\n onInfoWindowClose = () =>\r\n this.setState({\r\n activeMarker: null,\r\n showingInfoWindow: false\r\n });\r\n\r\n onMapClicked = () => {\r\n if (this.state.showingInfoWindow)\r\n this.setState({\r\n activeMarker: null,\r\n showingInfoWindow: false\r\n });\r\n };\r\n\r\n render() {\r\n if (!this.props.loaded) return \u003cdiv>Loading...\u003c/div>;\r\n\r\n return (\r\n \u003cMap\r\n className=\"map\"\r\n google={this.props.google}\r\n onClick={this.onMapClicked}\r\n style={{ height: \"100%\", position: \"relative\", width: \"100%\" }}\r\n zoom={14}\r\n >\r\n \u003cMarker\r\n name=\"SOMA\"\r\n onClick={this.onMarkerClick}\r\n position={{ lat: 37.778519, lng: -122.40564 }}\r\n />\r\n\r\n \u003cMarker\r\n name=\"Dolores park\"\r\n onClick={this.onMarkerClick}\r\n position={{ lat: 37.759703, lng: -122.428093 }}\r\n />\r\n\r\n \u003cMarker name=\"Current location\" onClick={this.onMarkerClick} />\r\n\r\n \u003cInfoWindow\r\n marker={this.state.activeMarker}\r\n onClose={this.onInfoWindowClose}\r\n visible={this.state.showingInfoWindow}\r\n >\r\n \u003cdiv>\r\n \u003ch1>{this.state.selectedPlace.name}\u003c/h1>\r\n \u003c/div>\r\n \u003c/InfoWindow>\r\n\r\n \u003cInfoWindow position={{ lat: 37.765703, lng: -122.42564 }} visible>\r\n \u003csmall>\r\n Click on any of the markers to display an additional info.\r\n \u003c/small>\r\n \u003c/InfoWindow>\r\n \u003c/Map>\r\n );\r\n }\r\n}\r\n// export default WithMarkers;\r\nexport default GoogleApiWrapper({\r\n apiKey: \"KEY\"\r\n})(WithMarkers);\r\n\r\n```\r\n","author":{"url":"https://github.com/abhijeetnavgire158","@type":"Person","name":"abhijeetnavgire158"},"datePublished":"2021-04-29T12:25:27Z","url":"https://github.com/fullstackreact/google-maps-react/issues/512"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e65ba667-2376-c6fc-7033-667f937e72f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD08:61466:753664:9F8C82:6AFE6A6A |
| html-safe-nonce | 7edc40836c508d6d5014967f45272dbe35f49120819ddde5cd99224622a489cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDA4OjYxNDY2Ojc1MzY2NDo5RjhDODI6NkFGRTZBNkEiLCJ2aXNpdG9yX2lkIjoiMTgzNzYzOTQyMTk1Njg3NjkwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c1b2a84a371c08b4eeddf29dfa8cb51a38f610d54a047ac8c71da5ea24249aff |
| hovercard-subject-tag | issue:870959523 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/fullstackreact/google-maps-react/512/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1a5b155aa8f25354632815993d628b4971e3c2290f097a55f68cace50adff3d5/fullstackreact/google-maps-react/issues/512 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1a5b155aa8f25354632815993d628b4971e3c2290f097a55f68cace50adff3d5/fullstackreact/google-maps-react/issues/512 |
| og:image:alt | I was tried to get the onClick event on the marker but I'm not able to get that. I was going through the document also I was created the static position and marker still it's not getting it. can so... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abhijeetnavgire158 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/fullstackreact/google-maps-react git https://github.com/fullstackreact/google-maps-react.git |
| octolytics-dimension-user_id | 16674738 |
| octolytics-dimension-user_login | fullstackreact |
| octolytics-dimension-repository_id | 57070925 |
| octolytics-dimension-repository_nwo | fullstackreact/google-maps-react |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 57070925 |
| octolytics-dimension-repository_network_root_nwo | fullstackreact/google-maps-react |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width