import { RefObject } from 'react'; import { AnimationInput } from '../AnimationInput.js'; /** * Low-level hook that will animate the ref'd HTML element with the given currentAnimation name * * Note: will interrupt and play a new animation if the animations stored at data-animations change and the Component using this hook is rerendered * * @typeParam A the accepted animation names * @typeParam E the type of element to be ref'd * @param currentAnimation On changing to a non-null value, will start the animation at animations[currentAnimation]. * If given null, will cancel() any current animations * If given a new or null value while the previous aninmation is not finished(), * will commit the current style to the element and call onAnimationEnd * @param animations The mapping of animationName to AnimationInput * @param onAnimationEnd callback to be called when the animation is finished(), or if the animation is interrupted by a new currentAnimation. Must be stable across renders. * @returns react Ref to be assigned to the Animated element */ declare function useAnimatedRef(currentAnimation: A | null, animations: Record, onAnimationEnd?: (completedAnimationName: A | null, webAnimation: Animation | null) => void): RefObject; export default useAnimatedRef;