ReactVision / starter-kit

React Native project setup with Viro 🚀
MIT License
141 stars 94 forks source link

When i try to use assets in starter-kit viro project, the app would crash #69

Closed Kurniawanrzk closed 7 months ago

Kurniawanrzk commented 7 months ago

Encountering an issue, whenever I attempt to utilize assets in the Viro project's starter kit, leads to the application crashing. This occurs while running the app on my Android device. Is there a solution to resolve this problem?

This i my full code:

import {
  ViroARScene,
  ViroText,
  ViroTrackingStateConstants,
  ViroARSceneNavigator,
  ViroTrackingReason,
  ViroBox,
  ViroMaterials
} from "@viro-community/react-viro";

const InitialScene = () => {
  ViroMaterials.createMaterials({
    wood:{
      diffuseTexture:require('./assets/wood.png')
    }
  })

  return(
    <ViroARScene>
    <ViroBox 
    height={2}
    length={2}
    width={2}
    scale={[0.2, 0.2, 0.2]}
    position={[0, -1, -1]}
    materials={['wood']}
    />
  </ViroARScene>
  );
};
export default () => {
  return (
    <ViroARSceneNavigator 
    initialScene={{
      scene:InitialScene
    }}
    style={{flex:1}}
    />
  );
};

Here's where i try to use assets :

const InitialScene = () => {
  ViroMaterials.createMaterials({
    wood:{
      diffuseTexture:require('./assets/wood.png')
    }
  })

Here's the assets:

image

I try with other thing like ViroImage and Viro360Image. And it do the same thing. I'm sorry for my poor english

linear[bot] commented 7 months ago

XR-171 When i try to use assets in starter-kit viro project, the app would crash

robertjcolley commented 7 months ago

I'm closing this since this doesn't seem to be an issue with the starter kit out of the box. If this is an issue you're having with NativeVision, please create a new issue here: https://github.com/NativeVision/viro/issues