alex3165 / react-mapbox-gl

A React binding of mapbox-gl-js
http://alex3165.github.io/react-mapbox-gl/
MIT License
1.93k stars 534 forks source link

Support for additional events (e.g., those for mapbox-gl-draw) #895

Open ThisIsMissEm opened 4 years ago

ThisIsMissEm commented 4 years ago

When using this library along with mapbox-gl-draw it's not possible to listen to the draw events currently. Whilst I appreciate not supporting all the events, I think it should be possible to support additional events by allowing a user to pass an object of additional event mappings.

Alternatively, you could support any other key that doesn't have a mapping by automatically "guessing" a mapping, e.g., drawSelectionchange draw.selectionchange by replacing uppercase letters with lowercase ones preceded by a period (should be possible with a little str.replace(regex, fn))

This would allow better deeper integration with the entire mapbox-gl ecosystem.

I'd be happy to help write a PR if this feature is acceptable.

solarstar101 commented 4 years ago

ive been using react-mapbox-gl-draw,

they have a context api as well so you have access to the mapbox draw library as well