useNodeRef is a custom React Hook to receive a stable ref setter with an optional onChange handler.

Usage

const SomeComponent = ({ someProp }) => {
  const [node, setNodeRef] = useNodeRef<Animated.View>();

  return <Animated.View ref={setNodeRef} />;
};