Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes when navigating to ViroARSceneNavigator from StackNavigator. #986

Open
amir-aa1908770 opened this issue Feb 25, 2023 · 1 comment

Comments

@amir-aa1908770
Copy link

amir-aa1908770 commented Feb 25, 2023

**When I navigate from Home component to Scene1 app crashes and closes.

If anyone knows how to solve this issue, please help.**

App.js

const Stack = createStackNavigator();

const Scene1 = ({navigation}) => {
  return (
    <ViroARSceneNavigator
      initialScene={{
        scene: SceneAR,
        passProps: {navigation},
      }}
    />
  );
};
const Home = ({navigation}) => {
  return (
    <>
      <View>
        <Text>Vei</Text>
        <Button
          title="Test AR"
          onPress={() => navigation.navigate('Scene1')}></Button>
      </View>
    </>
  );
};
const App = () => {
  return (
    <NavigationContainer>
      <Stack.Navigator screenOptions={{headerShown: false}}>
        <Stack.Screen name="Home" component={Home} />
        <Stack.Screen  name="Scene1" component={Scene1} />
      </Stack.Navigator>
    </NavigationContainer>
    // <Scene1 />
  );
};
export default App;

SceneAR.js

class SceneAR extends Component {

  render() {
    ViroARTrackingTargets.createTargets({
      skullImage: {
        source: require('./assets/QRcode.png'),
        orientation: 'Up',
        physicalWidth: 0.1,
        type: 'Image',
      },
    });
    const anchorFound = () => {
      console.log('Image Detected');
    };
    return (
      <ViroARScene>

        <ViroARImageMarker target="skullImage" onAnchorFound={anchorFound}>
          <ViroImage
              rotation={[-90, 0, 0]}
              scale={[0.2, 0.2, 0]}
              position={[0,0,0.2]}
              source={require('./res/tracking_diffuse_2.png')}
            />

        </ViroARImageMarker>
      </ViroARScene>
    );
  }
}
export default SceneAR;

@amol909
Copy link

amol909 commented Jun 1, 2023

Did you find any solution? Even i am having a similar issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@amol909 @amir-aa1908770 and others