undefined is not an object (evaluating 'RootComponent.prototype')

只谈情不闲聊 提交于 2019-12-22 06:35:29

问题


---------index.js--------

import { AppRegistry } from 'react-native';
import Navigate from './Navigate';

AppRegistry.registerComponent('form1', () => Navigate);

----Navigate.js-----

import React from 'react';
import { StackNavigator, DrawerNavigator } from 'react-navigation';
import TabsList from './TabsList';

export const StackTab1 = StackNavigator({
    TabList: { screen: TabsList},
});

export const Navigate =  DrawerNavigator(
    {
       Tab1: { screen : StackTab1 },
       Tab2: { screen : StackTab1 },
       Tab3: { screen : StackTab1 }
    });

Whenever I try to run my android simulator, I'm getting that error. All modules are installed, no errors being thrown within my IDE except for the one that's appearing in my simulator.

Picture below of error:


回答1:


You are not importing Navigate properly.

Use

import { Navigate } from './Navigate';

instead of

import Navigate from './Navigate';


来源:https://stackoverflow.com/questions/50576741/undefined-is-not-an-object-evaluating-rootcomponent-prototype

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!