From 08b9f9a2aadc8f73d236f814a2541910fcbd8867 Mon Sep 17 00:00:00 2001 From: Zach Plata Date: Fri, 2 Jun 2023 13:47:00 -0500 Subject: [PATCH] Also export the container ref current element --- src/hooks/useRive.tsx | 1 + src/types.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/hooks/useRive.tsx b/src/hooks/useRive.tsx index 42e0b82..3fed470 100644 --- a/src/hooks/useRive.tsx +++ b/src/hooks/useRive.tsx @@ -199,6 +199,7 @@ export default function useRive( return { canvas: canvasRef.current, + container: containerRef.current, setCanvasRef, setContainerRef, rive, diff --git a/src/types.ts b/src/types.ts index 0f69171..c188404 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,6 +18,7 @@ export type Dimensions = { /** * @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 @@ -27,6 +28,7 @@ export type Dimensions = { */ export type RiveState = { canvas: HTMLCanvasElement | null; + container: HTMLElement | null; setCanvasRef: RefCallback; setContainerRef: RefCallback; rive: Rive | null;