zcreativelabs / react-simple-maps

Beautiful React SVG maps with d3-geo and topojson using a declarative api.
https://www.react-simple-maps.io/
MIT License
3.07k stars 424 forks source link

Components should forwardRef #279

Closed daedalus28 closed 2 years ago

daedalus28 commented 2 years ago

First of all, thanks for this library - it's an excellent tool 🤗

None of the components in this library currently forward along refs, which makes it hard to use with other libs. An example use case is with the Tooltip from CharkraUI (https://chakra-ui.com/docs/components/overlay/tooltip#usage), which expects children to be able to forward refs along. I've inlined a quick fork of Geography in my app to make this work. The diff is pretty trivial - would you be open to a PR adding refs so I don't need to live on a fork?

Here's an example of the diff for Geography

Screen Shot 2022-05-09 at 9 15 03 PM
zimrick commented 2 years ago

v3 should be forwarding the ref properly now.