🎥 Make videos programmatically with React
`@remotion/rive`: Ensure `ref` is available before calling `onLoad`
Jonny Burger919d670de968
diff --git a/packages/rive/src/RemotionRiveCanvas.tsx b/packages/rive/src/RemotionRiveCanvas.tsxindex f4296580f9..c065c7eed6 100644--- a/packages/rive/src/RemotionRiveCanvas.tsx+++ b/packages/rive/src/RemotionRiveCanvas.tsx@@ -79,6 +79,7 @@ const RemotionRiveCanvasForwardRefFunction: React.ForwardRefRenderFunction<animation: LinearAnimationInstance;renderer: CanvasRenderer;artboard: Artboard;+ file: File;} | null>(null);useImperativeHandle(@@ -148,10 +149,8 @@ const RemotionRiveCanvasForwardRefFunction: React.ForwardRefRenderFunction<animation,artboard,renderer,+ file,});- if (onLoad) {- onLoad(file);- }});}).catch((newErr) => {@@ -167,6 +166,12 @@ const RemotionRiveCanvasForwardRefFunction: React.ForwardRefRenderFunction<enableRiveAssetCdn,]);+ useEffect(() => {+ if (onLoad && rive) {+ onLoad(rive.file);+ }+ }, [onLoad, rive]);+React.useEffect(() => {if (!riveCanvasInstance) {return;