SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Function useAnimatedMeasure

    • Enhanced version of useMeasure that provides real-time measurements during animations.

      Use for components that don't sit within the component hierarchy but could be animated. (for examples portal elements; menus, tooltips)

      Unlike the standard useMeasure hook which relies on ResizeObserver (which doesn't trigger during CSS transform animations), this hook actively monitors element bounds using requestAnimationFrame and CSS animation/transition events.

      Type Parameters

      • T extends Element = HTMLDivElement

      Parameters

      Returns readonly [(node: T | null) => void, UseMeasureRect | null]

      • Monitors all bounds properties: x, y, width, height, top, left, right, bottom
      • Detects animations on the element itself and all parent elements
      • Uses both position polling and event-based detection for optimal performance
      • Automatically stops monitoring when animations complete to save resources
      const [ref, bounds] = useAnimatedMeasure<HTMLDivElement>();

      return (
      <div ref={ref} style={{ transform: 'translateX(100px)' }}>
      Position: {bounds?.x}, {bounds?.y}
      </div>
      );