Also export the container ref current element

This commit is contained in:
Zach Plata
2023-06-02 13:47:00 -05:00
committed by Zachary Plata
parent a24b910096
commit 08b9f9a2aa
2 changed files with 3 additions and 0 deletions

View File

@@ -199,6 +199,7 @@ export default function useRive(
return {
canvas: canvasRef.current,
container: containerRef.current,
setCanvasRef,
setContainerRef,
rive,

View File

@@ -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<HTMLCanvasElement>;
setContainerRef: RefCallback<HTMLElement>;
rive: Rive | null;