Skip to content

[React Native] url.lastIndexOf is not a function (it is undefined) #3550

@Rakha112

Description

@Rakha112

Hey @CodyJasonBennett, I wasn’t sure whether this issue is coming from @react-three/fiber or @react-three/drei. The issue is when I try to load a GLB model using useGLTF with an import from @react-three/drei/native it throws an error like in the screenshot below.

Warning: TypeError: url.lastIndexOf is not a function (it is undefined)

But when I import directly from @react-three/drei, the model loads — however, the texture fails to load, and I get this error message instead.

THREE.GLTFLoader: Couldn't load texture {"_h": 1, "_i": 2, "_j": [Error: Creating blobs from 'ArrayBuffer' and 'ArrayBufferView' are not supported], "_k": null}

Here’s how to reproduce the issue:
1. Clone this repository
2. Install dependencies using yarn
3. Run the app with yarn expo start -c
4. You’ll see the following error:
Warning: TypeError: url.lastIndexOf is not a function (it is undefined)
5. Change the import in components/Character.tsx from @react-three/drei/native to @react-three/drei
6. The model will load, but the texture won’t.
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions