最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

three.js - React three fiber error rendering 3dmodels on expo react native 18.3.1 - Stack Overflow

programmeradmin4浏览0评论

Im running into alot of issues trying to run react three fiber on react native app(expo sdk 52). I have a simple box setup but get error saying 'cannot convert undefined value to object'. I tried playing around with different r3f versions and have yet to figure it out. New to r3f so any help would be appreciated.

"expo": "~52.0.37",
"@react-three/drei": "^8.8.0",
"@react-three/fiber": "^8.18.0",
"three": "^0.174.0",
"react": "^18.3.1",
"react-dom": "18.3.1",
"expo-gl": "~11.0.2",

import React from "react";
import { Canvas } from "@react-three/fiber/native";
import { View } from "react-native";
import * as THREE from "three";

const Box = () => {
  return (
    <View style={{ flex: 1 }}>
      <Canvas>
        <ambientLight intensity={0.5} />
        <pointLight position={[10, 10, 10]} />
        <mesh>
          <boxGeometry args={[1, 1, 1]} />
          <meshStandardMaterial color="blue" />
        </mesh>
      </Canvas>
    </View>
  );
};

export default Box;


 TypeError: Cannot convert undefined value to object

Tried updating and downgrading different versions of r3f, expo-gl but get same error. I tried importing GLTF using useGLTF and still was not succesful in rendering an object.

发布评论

评论列表(0)

  1. 暂无评论