onMouseLeave in Layer component not firing
See original GitHub issueHi there, the onMouseLeave callback on the Layer component is not working. Do you have a fix for that?
package.json
"mapbox-gl": "^1.0.0",
"react-mapbox-gl": "^4.2.3"
Component
import ReactMapboxGl, { Layer, Feature } from "react-mapbox-gl"
const mapShape = ...
let Map = false
// Gatsby specific config
if (typeof window !== `undefined`) {
Map = ReactMapboxGl({
accessToken: "..."
})
}
const Mapbox = () => {
return (
<>
{Map &&
<Map style="mapbox://styles/...">
<Layer
paint={{
"fill-color": "#000",
"fill-opacity": 1,
"fill-outline-color": "#fff"
}}
onMouseEnter={() => console.log('I'm working fine')}
onMouseLeave={() => console.log('I'm useless')}
>
<Feature coordinates={mapShape} />
</Layer>
</Map>
}
</>
)
}
Let me know if you need more information.
Cheers Robin
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
reactjs - mouseleave event not firing in gatsby component
I'm trying to create a drop down menu component and the mouseleave is not firing on the div. If i use document.addEventListerner('click' ...
Read more >onmouseleave does not fire if you have mutiple elements react
We see that the mouseleave event is always fired before the mouse enter event. The same is true if I have a react...
Read more >Element: mouseleave event - Web APIs | MDN
The mouseleave event is fired at an Element when the cursor of a pointing device (usually a mouse) is moved out of it....
Read more >mouseover event is not firing on element on which written
I found the solution. I used mouseenter event instead of mouseover and it worked.
Read more >UUserWidget::OnMouseLeave - Unreal Engine Documentation
const FPointerEvent & MouseEvent ). Remarks. The system will use this event to notify a widget that the cursor has left it. This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Confirmed in the latest one:
7.0.8
Actually it is not working for any onMouse… events for meGetting same behavior with the following versions:
"mapbox-gl": "^1.6.1" "react-mapbox-gl": "^4.8.2"