fix: only perform layout resizing if the Layout object exists

This commit is contained in:
CI
2024-10-30 20:30:03 +01:00
committed by Gordon
parent 83fa6635ec
commit e42f5e32d7

View File

@@ -83,7 +83,7 @@ export default function useRive(
*/
const onCanvasHasResized = useCallback(() => {
if (rive) {
if (rive.layout.fit === Fit.Layout) {
if (rive.layout && rive.layout.fit === Fit.Layout) {
if (canvasElem) {
// TODO (Gordon): expose these are properties on JS runtime
(rive as any)._devicePixelRatioUsed = devicePixelRatio;