We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b174f7 commit 444c30bCopy full SHA for 444c30b
2 files changed
src/hooks/useRive.tsx
@@ -142,6 +142,11 @@ export default function useRive(
142
riveRef.current = r;
143
r.on(EventType.Load, () => {
144
isLoaded = true;
145
+
146
+ if (options.onLoad) {
147
+ options.onLoad(r!);
148
+ }
149
150
// Check if the component/canvas is mounted before setting state to avoid setState
151
// on an unmounted component in some rare cases
152
if (canvasElem) {
src/types.ts
@@ -15,6 +15,7 @@ export type UseRiveOptions = {
15
useOffscreenRenderer: boolean;
16
shouldResizeCanvasToContainer: boolean;
17
shouldUseIntersectionObserver?: boolean;
18
+ onLoad?: (rive: Rive) => void;
19
};
20
21
export type Dimensions = {
0 commit comments