alexkatz / react-tiny-popover

A simple and highly customizable popover react higher order component with no other dependencies! Typescript friendly.
MIT License
452 stars 121 forks source link

Callback for when position changes #179

Closed KorySchneider closed 1 year ago

KorySchneider commented 1 year ago

Hello,

I would like to be able to pass a callback function like onPositionChange?: (position: PopoverPosition) => void that gets called when the popover repositions itself (i.e. goes to the next position in the positions list).

Currently I don't think it's possible to get this information without re-implementing the default positioning logic via the contentLocation prop. If I'm wrong in this assumption please let me know 🙂

Happy to look into opening a PR for this, doubly so if you can point me to the right spot.

Many thanks!

KorySchneider commented 1 year ago

Scratch that! Just realized I can get this via the PopoverState provided by the content render function. Cheers!