@particle-academy/react-fancy 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3248,12 +3248,17 @@ function useFloatingPosition(anchorRef, floatingRef, options = {}) {
|
|
|
3248
3248
|
}, [anchorRef, floatingRef, placement, offset]);
|
|
3249
3249
|
useLayoutEffect(() => {
|
|
3250
3250
|
if (!enabled) return;
|
|
3251
|
-
|
|
3252
|
-
|
|
3251
|
+
let raf = 0;
|
|
3252
|
+
let frames = 0;
|
|
3253
|
+
const measure = () => {
|
|
3253
3254
|
update();
|
|
3254
|
-
|
|
3255
|
+
if (!floatingRef.current && frames++ < 20) {
|
|
3256
|
+
raf = requestAnimationFrame(measure);
|
|
3257
|
+
}
|
|
3258
|
+
};
|
|
3259
|
+
measure();
|
|
3255
3260
|
return () => cancelAnimationFrame(raf);
|
|
3256
|
-
}, [update, enabled]);
|
|
3261
|
+
}, [update, enabled, floatingRef]);
|
|
3257
3262
|
useEffect(() => {
|
|
3258
3263
|
if (!enabled) return;
|
|
3259
3264
|
window.addEventListener("scroll", update, true);
|