mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
fix: update errors
This commit is contained in:
1 parent
4ff9a2ec7f
commit
c14efe86cc
34 files changed
+217
-280
No files matched your search
@@ -1,20 +1,20 @@
|
||||
import { Canvas, type CanvasProps } from '@react-three/fiber';
|
||||
import { forwardRef, useImperativeHandle, useRef } from 'react';
|
||||
import { useOnScreen } from '../hooks/useOnScreen';
|
||||
import { Canvas, type CanvasProps } from "@react-three/fiber";
|
||||
import { forwardRef, useImperativeHandle, useRef } from "react";
|
||||
import { useOnScreen } from "../hooks/useOnScreen";
|
||||
|
||||
export const SmartCanvas = forwardRef<HTMLCanvasElement, CanvasProps>(
|
||||
(props, ref) => {
|
||||
const canvas = useRef<HTMLCanvasElement>(null);
|
||||
const canvas = useRef<HTMLCanvasElement>(null!);
|
||||
const onScreen = useOnScreen(canvas);
|
||||
|
||||
useImperativeHandle(ref, () => canvas.current!, []);
|
||||
|
||||
return (
|
||||
<Canvas
|
||||
frameloop={onScreen ? 'demand' : 'never'}
|
||||
frameloop={onScreen ? "demand" : "never"}
|
||||
ref={canvas}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user