1

我正在使用 WIX-React-Native-Navigation 并在堆栈中推送组件时收到此错误。 错误

有一件事要说,我在 WIX-React-Native-Navigation 中使用Viro-React ARScene Navigation ( Scene Navigation )。

这是我的代码 index.js

import { AppRegistry } from 'react-native';
var OpenDoor = require('./app/base')
import Stack from './app/navigation';

import { Navigation } from "react-native-navigation";

AppRegistry.registerComponent('ViroSample', () => OpenDoor);

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
      stack: Stack
    }
  });
});

导航.js

import { Navigation } from "react-native-navigation";

import Base from './base';
import Menu from './components/Menu/menu';

Navigation.registerComponent('Base', () => Base);
Navigation.registerComponent('Menu', () => Menu);


const Stack = {
    children: [{
            component: {
                name: 'Base'
            },
        }
    ]
};

export default Stack;

base.js

import React, {Component} from 'react';
import {
    Alert,
    View
} from 'react-native';
import {ViroARSceneNavigator} from 'react-viro';
import { Navigation } from 'react-native-navigation';

import APIKeys from './index';
import Camera from './components/Camera/camera';
import MenuButton from './components/Menu/menu_button';


class Base extends Component {
    constructor(props) {
        super(props);
        this.navigateScreen = this.navigateScreen.bind(this);
    }

    navigateScreen(location) {
        Navigation.push(this.props.componentId, {
            component: {
                name: location
            }
        });
    }

    render() {
        return(
            <View style={styles.container}>
                <ViroARSceneNavigator
                    initialScene = {{
                        scene: Camera
                    }}
                    apiKey = {APIKeys.ViroReact}
                    style = {styles.ar_scene}
                />
                <MenuButton navigation={this.navigateScreen}/>
            </View>
        );
    }
};

const styles = {
    container: {
        flex: 1
    }
};

export default Base;
module.exports = Base;

纠正我,如果我在某个地方错了。

我正在做的是创建一个应用程序,用户可以在增强现实的帮助下虚拟地装饰家。移动应用程序是在 React-Native 上创建的,而用于增强现实的库是 Viro-React。

所以,当我想从一个屏幕导航到另一个屏幕时,在堆栈中推送组件时,我收到了这个错误。谢谢。

4

0 回答 0