Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React.createElement:类型无效--应为字符串(对于内置组件)或类/函数(对于复合组件)_Reactjs_Loops_For Loop_Native - Fatal编程技术网

Reactjs React.createElement:类型无效--应为字符串(对于内置组件)或类/函数(对于复合组件)

Reactjs React.createElement:类型无效--应为字符串(对于内置组件)或类/函数(对于复合组件),reactjs,loops,for-loop,native,Reactjs,Loops,For Loop,Native,我在创建for循环时遇到了这个错误 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, undefined, You likely forgot to export your component from the file it's

我在创建for循环时遇到了这个错误

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, undefined,  You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
导致错误的组件

import React from "react";
import {TabWidgetNamespace} from "shared/namespaces/tab-widget.namespaces";
import {StyleSheet, Text, TouchableWithoutFeedbackComponent, View} from "react-native";

export class TabWidgetComponent extends React.Component<TabWidgetNamespace.TabWidgetPropsInterface, TabWidgetNamespace.TabWidgetStateInterface>{

style = StyleSheet.create({
    TabContainer: {
        overflow: 'hidden',
    },
    TabNavigation: {
        overflow: 'hidden'
    },
})

constructor(props: TabWidgetNamespace.TabWidgetPropsInterface) {
    super(props);
}

render(): React.ReactNode {

    const navigationItems = this.props.tabNavigation.map( (item, index) => (
            <TouchableWithoutFeedbackComponent key={index}>
                <Text>{item.label}</Text>
            </TouchableWithoutFeedbackComponent>
    ) );

    return(
        <View style={this.style.TabContainer}>
            <View style={this.style.TabNavigation}>
                {{ navigationItems }}
            </View>
        </View>
    );
}
从“React”导入React;
从“shared/namespaces/tab widget.namespaces”导入{tabwidgetmespace};
从“react native”导入{样式表、文本、TouchableWithoutFeedbackComponent、视图};
导出类TabWidgetComponent扩展了React.Component{
style=StyleSheet.create({
选项卡容器:{
溢出:“隐藏”,
},
选项卡导航:{
溢出:“隐藏”
},
})
构造函数(props:tabwidgetmespace.TabWidgetPropsInterface){
超级(道具);
}
render():React.ReactNode{
const navigationItems=this.props.tabNavigation.map((项目,索引)=>(
{item.label}
) );
返回(
{{navigationItems}}
);
}
}


我尝试了“导出默认类ComponentName”,但出现了相同的错误。

出现此错误是因为您试图在此处渲染对象-

{{ navigationItems }}
你有额外的括号。应该是-

 { navigationItems }

发生此错误是因为您试图在此处渲染对象-

{{ navigationItems }}
你有额外的括号。应该是-

 { navigationItems }

@AliBatuhanBayraktar你能告诉我错误到底是哪一行吗?它说->检查你的代码在tab widget.component.tsx:23,在TabWidgetComponent(在App.tsx:52),在RCTView(在App.tsx:51),在App(在WithExpoot.js:26),在RootErrorBoundary(在WithExpoot.js:25),在Expoot(在renderApplication.js:40)在DevAppContainer(在AppContainer.js:101)的RCTView(在AppContainer.js:115)中,在AppContainer(在renderApplication.js:39)的RCTView(在AppContainer.js:119)中,@AliBatuhanBayraktar第23行,即
。刚刚选中react native documents它应该是
可触摸且无反馈的
而不是
可触摸且无反馈组件
。你是国王@AliBatuhanBayraktar你能告诉我错误到底是哪一行吗?它说->检查你的代码在tab widget.component.tsx:23,在TabWidgetComponent(在App.tsx:52),在RCTView(在App.tsx:51),在App(在WithExpoot.js:26),在RootErrorBoundary(在WithExpoot.js:25),在Expoot(在renderApplication.js:40)在DevAppContainer(在AppContainer.js:101)的RCTView(在AppContainer.js:115)中,在AppContainer(在renderApplication.js:39)的RCTView(在AppContainer.js:119)中,@AliBatuhanBayraktar第23行,即
。刚刚选中react native documents它应该是
可触摸且无反馈的
而不是
可触摸且无反馈组件
。你是国王