Skip to content

Texture loading fails in @react-three/drei/native with Expo 53 due to unpatched BlobManager usage #2493

@iyibu

Description

@iyibu

It seems that @react-three/drei/native's useGLTF is currently broken on Expo SDK 53 and React 19 due to an outdated usage of BlobManager. Although this has been patched in the latest commit of @react-three/fiber/native, it's not yet published. Combined with the way @react-three/drei/native imports textures, this results in a runtime error and prevents GLTF models from loading correctly.

I confirmed this behavior using the example from https://github.com/CodyJasonBennett/r3f-rn-simple/tree/master with the following package versions:

"dependencies": {
  "@expo/metro-runtime": "~5.0.4",
  "@react-three/drei": "^10.5.1",
  "@react-three/fiber": "^9.2.0",
  "expo": "^53",
  "expo-gl": "~15.1.7",
  "expo-status-bar": "~2.2.3",
  "react": "19.0.0",
  "react-dom": "19.0.0",
  "react-native": "0.79.5",
  "react-native-web": "~0.20.0",
  "three": "^0.167.1"
},
"devDependencies": {
  "@babel/core": "^7.26.0"
}

Additionally, I manually patched the following files under node_modules/@react-three/fiber/native/dist/ by updating the BlobManager import as follows (applied to all builds just in case):

  • react-three-fiber-native.cjs.dev.js
  • react-three-fiber-native.cjs.prod.js
  • react-three-fiber-native.esm.js
const BlobManagerModule = require('react-native/Libraries/Blob/BlobManager.js');
const BlobManager = BlobManagerModule.default ?? BlobManagerModule;

Also, I noticed that if the import:

import { useGLTF } from '@react-three/drei/native'

is changed to:

import { useGLTF } from '@react-three/drei'

(i.e., removing "native"), everything works correctly with Expo Go, Expo SDK 53, and React 19!

In summary:

  • If the latest commit on @react-three/fiber/native is published, and
  • If the bug in @react-three/drei/native is fixed,

then the following issues will be resolved:

  • Texture loading failures
  • a.k.a url.lastIndexOf is not a function error
  • a.k.a Error: Creating blobs from 'ArrayBuffer' and 'ArrayBufferView' are not supported error

Thank you very much. Best regards.

@CodyJasonBennett @krispya

Originally posted by @iyibu in #3550

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions