pmndrs / react-use-measure

🙌 Utility to measure view bounds
MIT License
836 stars 30 forks source link

Get left element position after react-spring animation #14

Open frankPairs opened 4 years ago

frankPairs commented 4 years ago

Hi everyone!

First at all, congratulation for your job with react-spring and react-use-measure: I am starting to use it and it's awesome the things you can do with simple code.

The issue I found is after trying to get the left position of an element.

I tried to get it from an animated element (via react-spring). I noticed that useMeasure hook is retuning the bounds object with the left position equals to the start of the animation.

Is there any way to get the position from useMeasure after the animation is completed?

Thanks in advance.

williaster commented 4 years ago

in vx we have a similar need to update bounds when the element moves/changes position, not just on scroll or resize as implemented now. Would you consider updating to handle this case?

I was wondering if using IntersectionObserver might be a way to detect the movement.