ReactVision / viro

ViroReact: The AR and VR library for React Native 📳💙💛🤍💚
MIT License
1.3k stars 150 forks source link

JS Materials error after building #140

Closed vandenbosschegiles closed 5 months ago

vandenbosschegiles commented 2 years ago

Requirements:

Please go through this checklist before opening a new issue

Environment

Please provide the following information about your environment:

  1. Development OS: Mac, Windows, Linux
  2. Device OS & Version: What Android OS version (7.0, 8.0, etc.) or iOS version (11.0, 11.2) is your device running on?
  3. Version: ViroReact version and React Native version
  4. Device(s): What device(s) are you are seeing the issue on (i.e. iPhone X, Samsung Note 8, etc)

Description

I am trying to use Viro with Bare Expo but I keep getting this error. Screenshot_20220602-155906__01__01

Reproducible Demo

Let us know how to reproduce the issue. Include a code sample, screen capture, video recording. The more information you provide, the better we can support you.

scrolls-mckenzie commented 2 years ago

I have the exact same issue.

Use expo to init new build. Followed instruction to import and link the Viro scripts and pods. Went through a fair bit of backwards and fourth to get all the dependencies and requirements. Am able to compile and run the Expo app and preview in Expo GO for the base init build.

As soon as I add the import to bring in the ViroCommunity components I get the same error where the material is null. This is even prior to applying anything inside of my app.js. It doesn't seem to seem to matter what component is imported as they all error in the same way. I had also attempted via xcode but has the same issue either in Expo or direct.

I would expect this error if i have not applied the material to the scene as it would need to exist however adding import to app.js is causing this prior to adding any scene code to the build.

Package.json dependencies

    "@viro-community/react-viro": "^2.23.0",
    "expo": "~45.0.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-web": "0.17.7"

basic app.js with base import

import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {
  ViroARScene,
  ViroText,
  ViroMaterials
} from '@viro-community/react-viro';

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Happy to provide any more details and looking forward to getting a fix

Edit

Little bit more digging around and the Expo documentation is talking about the fact that you may not be able to load custom code into the Go app. i have tried to follow the documentation and install all the required dependencies as well as the expo-dev-client. Has anyone had any success using the Viro core in an expo build in Go or do we need to run a full deploy to see the custom code?

Here is the link to the Expo documentation that i have seen.

https://docs.expo.dev/workflow/customizing/

Big shout out to the community and everyone who reads the forums.

Edit V2

Have had success building the app with Viro added but not included. Have commented more on this in #125 and will start a new bare build soon

Avtrkrb commented 5 months ago

I'm getting this error after upgrading viro community package along with react-native & expo packages.

robertjcolley commented 5 months ago

Can you check these expo docs?

I also notice you're on expo SDK 45, which is not officially supported. We support the official supported versions of Expo (47-50).

Viro doesn't work with Expo Go, Expo's preview app since it contains native code not built into the Expo Go app. You can create a custom dev client or use the 'expo prebuild' command.