我正在进行react本地项目,并且在实现react导航时遇到了问题。我遵循了一个教程,当我试图运行这个项目时,我得到了一个错误,上面写着:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it’s defined in.
我搜索了网络,包括这个网站,但没有找到任何解决
我无法获得react导航工作的示例。我总是以错误Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in.结束
这是使用中的示例
import React from 'react';
import {
AppRegis
当我遇到这个问题时,我正在练习我的react导航技能。如果这是一个新手问题,请原谅。这个标题几乎总结了这一切。我在Routes.js文件中定义了一个StackNavigator。当我运行它的时候,它不工作。但是如果我把它放到索引文件中,它就能正常工作。我确信我导出了StackNavigator,并将其导入到了我的AppRegistry所在的索引文件中。
我可能遗漏了什么,但我不确定是什么。
以下是错误消息:
Element type is invalid: expected a string (for built in
components) or a class/funct
我试图站起来和Vue原住民一起滚动,每当我试图导航到初始屏幕之后,我就会遇到同样的错误。
警告: React.createElement: type无效--需要一个字符串(用于内置组件)或一个类/函数(用于复合组件),但got:未定义。您可能忘记从定义在其中的文件中导出组件,或者您可能混淆了默认导入和命名导入。
Check the render method of ReactVueComponent.
in ReactVueComponent (at SceneView.js:17)
in SceneView (at CardStack.js:466)
in RCTView (
打开应用程序时显示错误。
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in.
这是我创建的基本代码。请参阅复制步骤:
使用命令create-react-native-app Aw
我正在编写一个应用程序使用,我使用。
在我下载的示例项目中,他们使用StackNavigator({...})来创建导航器,但是当我执行npm start时,我会看到一个警告,说明不推荐使用StackNavigator,而应该使用createStackNavigator。createStackNavigator也是我在在线教程中看到的函数。
问题是,在使用createStackNavigator时,我得到了一个错误:
[ts] Module '".../.../..."' has no exported member 'createStackNaviga