Skip to content

Commit 4b4f3a2

Browse files
fix: forward ref type error
1 parent ee53eb8 commit 4b4f3a2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ecctrl",
3-
"version": "1.0.37",
3+
"version": "1.0.38",
44
"author": "Erdong Chen",
55
"license": "MIT",
66
"description": "A floating rigibody character controller for R3F",

src/Ecctrl.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
RapierRigidBody,
99
type RigidBodyProps,
1010
} from "@react-three/rapier";
11-
import { useEffect, useRef, useMemo, type ReactNode, forwardRef } from "react";
11+
import { useEffect, useRef, useMemo, type ReactNode, forwardRef, type RefObject } from "react";
1212
import * as THREE from "three";
1313
import { useControls } from "leva";
1414
import { useFollowCam } from "./hooks/useFollowCam";
@@ -76,7 +76,7 @@ const Ecctrl = forwardRef<RapierRigidBody, EcctrlProps>(({
7676
// Other rigibody props from parent
7777
...props
7878
}: EcctrlProps, ref) => {
79-
const characterRef = ref || useRef<RapierRigidBody>()
79+
const characterRef = ref as RefObject<RapierRigidBody> || useRef<RapierRigidBody>()
8080
const characterModelRef = useRef<THREE.Group>();
8181

8282
/**

0 commit comments

Comments
 (0)