diff --git a/with-react-three-fiber/App.js b/with-react-three-fiber/App.js index ee33f7ec..220e7b29 100644 --- a/with-react-three-fiber/App.js +++ b/with-react-three-fiber/App.js @@ -5,17 +5,14 @@ import { StyleSheet, View } from "react-native"; import { Canvas, useFrame } from "@react-three/fiber"; function Box(props) { - // This reference will give us direct access to the mesh const mesh = useRef(); - - // Set up state for the hovered and active state const [hovered, setHover] = useState(false); const [active, setActive] = useState(false); - // Rotate mesh every frame, this is outside of React without overhead - useFrame(() => { + useFrame((state, delta) => { if (mesh && mesh.current) { - mesh.current.rotation.x = mesh.current.rotation.y += 0.01; + mesh.current.rotation.x += delta; + mesh.current.rotation.y += delta; } }); @@ -23,16 +20,13 @@ function Box(props) { setActive(!active)} onPointerOver={(e) => setHover(true)} onPointerOut={(e) => setHover(false)} > - - + + ); } @@ -41,8 +35,8 @@ export default function App() { return ( - - + + diff --git a/with-react-three-fiber/package.json b/with-react-three-fiber/package.json index a8a0a567..cc083ee7 100644 --- a/with-react-three-fiber/package.json +++ b/with-react-three-fiber/package.json @@ -1,17 +1,17 @@ { "dependencies": { - "@react-three/fiber": "^8.3.1", + "@react-three/fiber": "^9.6.1", "expo": "^56.0.4", "expo-asset": "~56.0.14", "expo-file-system": "~56.0.7", "expo-gl": "~56.0.5", "expo-modules-core": "~56.0.12", - "expo-three": "^6.2.0", + "expo-three": "^8.0.0", "react": "19.2.3", "react-dom": "19.2.3", "react-native": "0.85.3", "react-native-web": "^0.21.0", - "three": "^0.145.0" + "three": "^0.184.0" }, "devDependencies": { "@expo/metro-runtime": "~56.0.12"