null不是对象(评估'this.nativeCommandsModule.push')

时间:2019-10-16 12:00:58

标签: react-native wix-react-native-navigation viro-react

我正在使用WIX-React-Native-Navigation,并且在将组件推入堆栈时出现此错误。 Error

一句话,我在WIX-React-Native-Navigation中使用 Viro-React ARS场景导航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
    }
  });
});

navigation.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。

因此,当我想从一个屏幕导航到另一个屏幕,然后在推入堆栈中的组件时遇到此错误。 谢谢。

0 个答案:

没有答案