简体   繁体   English

React Native Error:元素类型无效

[英]React Native Error: Element Type is Invalid

I need some help looking for where to start with this error I'm getting. 我需要一些帮助来寻找从这个错误开始的地方。 Nimbus is the name of my app but I'm not sure what it means when it says check the render method of 'Nimbus' . Nimbus是我的应用程序的名称,但我不确定它在check the render method of 'Nimbus'时意味着什么。 Which render method? 哪种渲染方法? I have a functional component at app/index.js called Nimbus but obviously that doesn't render anything just returns a component. 我在app/index.js有一个名为Nimbus的功能组件,但显然不会渲染任何东西只返回一个组件。

I've checked similar error messages for RN on here and most people are just forgetting to export a component properly but I've checked my components and all are being exported correctly from what I can tell. 我在这里检查了RN的类似错误消息,大多数人只是忘记正确导出组件,但我已经检查了我的组件,所有这些都是从我能说的正确导出的。 The repo is below if you want to take a look at my project structure, etc. There are only a few files right now. 如果您想查看我的项目结构等,下面的回购就在下面。现在只有几个文件。 Sorry I can't provide more information that's all I've got right now. 对不起,我无法提供更多我现在所拥有的信息。

https://github.com/MaxwellGover/Nimbus https://github.com/MaxwellGover/Nimbus

在此输入图像描述

Because the AppContainer is a default export: 因为AppContainer是默认导出:

export default class AppContainer ...

And you proxy it from the containers/index.js like this: 你从containers / index.js代理它,如下所示:

export { AppContainer } from  './App/AppContainer'

This tries to import a named export called AppContainer . 这会尝试导入名为AppContainer的命名导出。 Instead, you'll need to import the default export explicitly: 相反,您需要显式导入default导出:

export { default as AppContainer } from  './App/AppContainer'

in your index.js you need to import component. index.js您需要导入组件。

change following. 改变以下。

import { NimbusNavigator } from  './Navigator/NimbusNavigator'
import { SplashContainer } from './Splash/SplashContainer'
import { AppContainer } from  './App/AppContainer'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM