import { RefCallback, ComponentProps } from 'react'; import { Rive, RiveParameters } from '@rive-app/canvas'; export type UseRiveParameters = Partial> | null; export type UseRiveOptions = { useDevicePixelRatio: boolean; fitCanvasToArtboardHeight: boolean; useOffscreenRenderer: boolean; shouldResizeCanvasToContainer: boolean; }; export type Dimensions = { width: number; height: number; }; /** * @typedef RiveState * @property canvas - Canvas element the Rive Animation is attached to. * @property container - Container element of the canvas. * @property setCanvasRef - Ref callback to be passed to the canvas element. * @property setContainerRef - Ref callback to be passed to the container element * of the canvas. This is optional, however if not used then the hook will * not take care of automatically resizing the canvas to it's outer * container if the window resizes. * @property rive - The loaded Rive Animation */ export type RiveState = { canvas: HTMLCanvasElement | null; container: HTMLElement | null; setCanvasRef: RefCallback; setContainerRef: RefCallback; rive: Rive | null; RiveComponent: (props: ComponentProps<'canvas'>) => JSX.Element; };