mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
fix: only perform layout resizing if the Layout object exists
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user