Comments (11)
I've found a solution that seems to work nicely using the static preventMapHitsFrom and preventMapHitsAndGesturesFrom methods from https://developers.google.com/maps/documentation/javascript/reference/overlay-view#OverlayView.preventMapHitsFrom
In your component or HTML Element within your OverlayView you can call preventMapHitsFrom on your element that you don't want your mouse or touch events filtering down to the map
class OverlayInner extends React.Component {
handleClick = () => {
console.log('I still work');
}
render () {
<div
ref={ ref => ref && google.maps.OverlayView.preventMapHitsFrom(ref) }
onClick={this.handleClick}
/>
Dont click map
</div>
}
}
Your standard onClick events will continue to work.
from react-google-maps.
Wow... is that new @madrussa? That's worked perfectly.
I spent over a year looking for a fix for that...
from react-google-maps.
Actually, I've found a workaround: added overlayHovered flag to the state and check it in handleMapClick function.
from react-google-maps.
Second that. As I understand, this is not the intended behavior of Google Maps. It breaks the use case when OverlayView is used to display a menu, which is closed by clicking on the map.
from react-google-maps.
I've noticed the same behavior in the #basics/overlay-view example.
from react-google-maps.
Having the same issue here, was there a better solution for this?
from react-google-maps.
Feel free to submit a PR. Close for now
We're also looking for maintainers. Involve in #266 to help strengthen our community!
from react-google-maps.
Anyone find a good solution for this?
from react-google-maps.
This seems to be a bug inherent in google maps.
One guy said he found a fix, but that didn't work for me...
And the hover solution suggested by @ksavenkov and another guy in this stackoverflow thread doesn't work on mobile, so not a long term fix.
I've had to deal with this issue a year ago, and now coming back to it again. I think it's getting to a point where I'd pay money
from react-google-maps.
up please
from react-google-maps.
Yeah it looks new. I can see it in 3.33 but not 3.32. My only concern is that it's a black hole and it could lead to memory leaks... as you feed it references, but what happens when they remove?
from react-google-maps.
Related Issues (20)
- React Version HOT 3
- how to add button re center on map HOT 1
- Problems while implementing Content Security Policy HOT 1
- Polygon not being drawn on the map HOT 1
- CWE-601 Security Vulnerability found in one of the transitive dependencies HOT 1
- Legacy context API has been detected within a strict-mode tree. HOT 1
- AutoComplete Default Value
- Check this use 'window'
- Error when installing HOT 3
- Could not resolve dependency: npm ERR! peer react@"^16 || ^17" from [email protected]
- Problem in Installation HOT 2
- I can not push custom control button to the map
- More than 700 re renderings HOT 1
- Is there any benefits to using MarkerClusterer, rather than simply using Markers?
- Best Way To Style Marker Labels?
- KMlLayer 2d, 3d kmz file or kml file highlighted layer not showing
- f.setPosition is not a function
- How can I get the DOM element for Marker?
- disable map zoom when DirectionsRenderer redraws the path
- Upgrade jQuery dependency inside scriptjs package. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-google-maps.