I can’t load a texture, my application just crashes with no errors. I created a react native project using Expo.
import { TextureLoader } from 'expo-three'
const BackPlane = () => {
const texture = useLoader(TextureLoader,'../../../assets/textures/ambient/backgrid.png')
...
Solved!
import { useLoader } from '@react-three/fiber/native'
import { TextureLoader } from 'three'
import { Texture } from 'three'
import { TextureLoaderException } from '../exceptions/TextureLoaderException'
export const useTextureLoader = (): Texture => {
const texture = useLoader(
TextureLoader,
require('../../assets/textures/ambient/backgrid.png')
)
if (!texture || texture === null || Array.isArray(texture)) throw new TextureLoaderException()
return texture
}