Skip to content

Commit febdc17

Browse files
committed
compatible with react 19 and r3f v9
1 parent 4f4eae4 commit febdc17

File tree

43 files changed

+4016
-3397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4016
-3397
lines changed

examples/demo-controller/app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Canvas, createPortal, GroupProps, useFrame } from '@react-three/fiber'
2-
import { createXRStore, XR, useLoadXRControllerLayout, useLoadXRControllerModel } from '@react-three/xr'
1+
import { Canvas, createPortal, ThreeElements, useFrame } from '@react-three/fiber'
2+
import { useLoadXRControllerLayout, useLoadXRControllerModel } from '@react-three/xr'
33
import { XRControllerGamepadComponentId, XRControllerLayout, getXRControllerComponentObject } from '@pmndrs/xr'
44
import { PropsWithChildren, Suspense, useEffect, useRef, useState } from 'react'
55
import { Group, MeshBasicMaterial, Object3D } from 'three'
@@ -23,7 +23,7 @@ export function App() {
2323
)
2424
}
2525

26-
function TutorialController(props: Omit<GroupProps, 'children'>) {
26+
function TutorialController(props: Omit<ThreeElements['group'], 'children'>) {
2727
const layout = useLoadXRControllerLayout(['meta-quest-touch-plus'], 'right')
2828
const model = useLoadXRControllerModel(layout)
2929
const materialRef = useRef<MeshBasicMaterial>(null)

examples/demo-controller/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"dependencies": {
33
"@pmndrs/xr": "workspace:^",
4-
"@react-three/drei": "^9.112.0",
54
"@react-three/uikit": "^0.5.3",
65
"@react-three/xr": "workspace:^"
76
},

examples/editor/app.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ function Hover({
642642
children,
643643
hoverTargetRef,
644644
}: {
645-
hoverTargetRef?: RefObject<Object3D>
645+
hoverTargetRef?: RefObject<Object3D | null>
646646
children?: (hovered: boolean) => ReactNode
647647
}) {
648648
const ref = useRef<Group>(null)
@@ -664,7 +664,15 @@ function vibrateOnEvent(e: PointerEvent) {
664664

665665
extend({ MeshLineGeometry, MeshLineMaterial })
666666

667-
function StripedLineToCenter({ fromRef, width, color }: { fromRef: RefObject<Object3D>; width: number; color: Color }) {
667+
function StripedLineToCenter({
668+
fromRef,
669+
width,
670+
color,
671+
}: {
672+
fromRef: RefObject<Object3D | null>
673+
width: number
674+
color: Color
675+
}) {
668676
const ref = useRef<Mesh>(null)
669677
const materialRef = useRef<MeshLineMaterial>(null)
670678
useFrame(() => {
@@ -690,8 +698,8 @@ function StripedLineToCenter({ fromRef, width, color }: { fromRef: RefObject<Obj
690698
)
691699
}
692700

693-
const handleStartAudioEffectRef: RefObject<PAudio> = { current: null }
694-
const handleEndAudioEffectRef: RefObject<PAudio> = { current: null }
701+
const handleStartAudioEffectRef: RefObject<PAudio | null> = { current: null }
702+
const handleEndAudioEffectRef: RefObject<PAudio | null> = { current: null }
695703

696704
function AudioEffects() {
697705
return (

examples/editor/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"dependencies": {
33
"@pmndrs/handle": "workspace:^",
44
"@pmndrs/pointer-events": "workspace:^",
5-
"@react-three/drei": "^9.118.0",
65
"@react-three/handle": "workspace:^",
76
"@react-three/xr": "workspace:^",
87
"meshline": "^3.3.1",

examples/handheld-ar/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"dependencies": {
3-
"@react-three/drei": "^9.109.2",
43
"@react-three/xr": "workspace:^"
54
},
65
"scripts": {

examples/handle/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"@dimforge/rapier3d-compat": "^0.14.0",
44
"@pmndrs/handle": "workspace:^",
55
"@pmndrs/pointer-events": "workspace:^",
6-
"@react-three/drei": "^9.118.0",
76
"@react-three/handle": "workspace:^",
87
"@react-three/rapier": "^1.5.0",
98
"@react-three/xr": "workspace:^"

examples/handle/smoke.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { InstancedMeshProps, useFrame } from '@react-three/fiber'
1+
import { ThreeElements, useFrame } from '@react-three/fiber'
22
import { useEffect, useMemo, useRef } from 'react'
33
import {
44
BufferGeometry,
@@ -28,7 +28,7 @@ export function Smoke({
2828
maxSize: number
2929
minSize: number
3030
spawnRate: number
31-
} & InstancedMeshProps) {
31+
} & Omit<ThreeElements['instancedMesh'], 'args'>) {
3232
const ref = useRef<InstancedMesh<BufferGeometry, MeshBasicMaterial>>(null)
3333
const maxLength = (count / spawnRate) * speed
3434
const opacityAttribute = useMemo(() => {

examples/layers/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"dependencies": {
33
"@pmndrs/pointer-events": "workspace:^",
4-
"@react-three/drei": "^9.111.0",
54
"@react-three/xr": "workspace:^"
65
},
76
"scripts": {

examples/minecraft/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"dependencies": {
3-
"@react-three/drei": "^9.108.4",
43
"@react-three/rapier": "^1.4.0",
54
"@react-three/xr": "workspace:^",
65
"zustand": "^4.5.4"

examples/minecraft/src/Axe.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ title: Minecraft Diamond Axe
77
*/
88

99
import { useGLTF } from '@react-three/drei'
10-
import { GroupProps } from '@react-three/fiber'
10+
import { ThreeElements } from '@react-three/fiber'
1111
import { Mesh } from 'three'
1212

13-
export function Axe(props: GroupProps) {
13+
export function Axe(props: ThreeElements['group']) {
1414
const { nodes, materials } = useGLTF('axe.glb')
1515
return (
1616
<group dispose={null} {...props}>

0 commit comments

Comments
 (0)