Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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
React native 元素类型无效:应为字符串_React Native_React Native Android_React Native Ios_Native Base - Fatal编程技术网

React native 元素类型无效:应为字符串

React native 元素类型无效:应为字符串,react-native,react-native-android,react-native-ios,native-base,React Native,React Native Android,React Native Ios,Native Base,我检查了所有代码,但没有发现可能导致如此奇怪错误的错误。正如您看到的,它是导出的,而它说您可能忘记了导出。以下是包含完整导入列表的代码: import "expo"; import React from "react"; import {Image, TouchableHighlight} from "react-native"; import { Content, Left, Right, Icon, CardItem, Card, Button, Text,

我检查了所有代码,但没有发现可能导致如此奇怪错误的错误。正如您看到的,它是导出的,而它说您可能忘记了导出。以下是包含完整导入列表的代码:

 import "expo";
import React from "react";
import {Image, TouchableHighlight} from "react-native";
import {
  Content,
  Left,
  Right,
  Icon,
  CardItem,
  Card,
  Button,
  Text,
  Body,
  Row,
  Col,
  Grid,
  Thumbnail,
  ScrollView

} from "native-base";

import {dataRow1,dataRow2,dataRow3,dataRow4} from "../data/HomeData";
import { primary, secondary, grey } from '../styles/variables'; 


    const HomeContent = props => {
      return (
        <Content>
        <ScrollView horizontal>

          {dataRow1.map((item, idx) => {
            return <CardItemContainer {...props} key={idx} item={item} />;
          })}
            </ScrollView>
         <ScrollView horizontal>

          {dataRow2.map((item, idx) => {
            return <CardItemContainer {...props} key={idx} item={item} />;
          })}
            </ScrollView>
         <ScrollView horizontal>
              {dataRow3.map((item, idx) => {
            return <CardItemContainer {...props} key={idx} item={item} />;
          })}
            </ScrollView>
         <ScrollView horizontal>

          {dataRow4.map((item, idx) => {
            return <CardItemContainer {...props} key={idx} item={item} />;
          })}

        </ScrollView>
    </Content>
      );
    };


    const CardItemContainer = ({item, navigation}) => {
      return (
        <Card style={{marginBottom: 10}}>
          <TouchableHighlight onPress={() => navigation.navigate("Items")}>
            <CardItem cardBody>
              <Image
                source={item.image}
                style={styles.img}
          />
            </CardItem>
          </TouchableHighlight>
          <CardItem>
        <Text style={{color:grey}}> {item.title} </Text>

          </CardItem>
        </Card>
      );
    };


    const styles = {
      img:{
        height: 200,
         width: null,
          flex: 1
      },
    }

    export default HomeContent;
导入“世博会”;
从“React”导入React;
从“react native”导入{Image,TouchableHighlight};
进口{
所容纳之物
左边
正当
偶像
卡迪姆,
卡片
按钮
文本
身体
一行
上校,
网格
缩略图,
卷轴视图
}来自“本土基地”;
从“./data/HomeData”导入{dataRow1、dataRow2、dataRow3、dataRow4};
从“../styles/variables”导入{primary,secondary,grey};
const HomeContent=props=>{
返回(
{dataRow1.map((项,idx)=>{
回来
})}
{dataRow2.map((项,idx)=>{
回来
})}
{dataRow3.map((项,idx)=>{
回来
})}
{dataRow4.map((项,idx)=>{
回来
})}
);
};
const CardItemContainer=({item,navigation})=>{
返回(
导航。导航(“项目”)}>
{item.title}
);
};
常量样式={
img:{
身高:200,
宽度:空,
弹性:1
},
}
导出默认的家庭内容;
什么会导致这种情况,什么是错误的?你能帮我解决这个问题吗


提前谢谢

看起来您没有从
react native
导入任何html标记引用。每个HTML标记都是一个元素


假设您有
Text
标记,那么您必须像从react native导入{Text}一样从react native导入它。

看起来您没有从react native导入任何html标记引用。每个HTML标记都是一个元素


假设您有
Text
标记,那么您必须像从react native导入{Text}一样从react native导入它。

您应该从react native而不是从native base导入ScrollView

从本机基本导入行中删除ScrollView后,将其包括在react-native的导入行中,如下所示:

import {Image, TouchableHighlight, ScrollView} from "react-native";

您应该从react native而不是native base导入ScrollView

从本机基本导入行中删除ScrollView后,将其包括在react-native的导入行中,如下所示:

import {Image, TouchableHighlight, ScrollView} from "react-native";

请添加代码中的所有导入语句我刚刚添加了:)您可以尝试更改HomeContent和CardItemContainer的顺序吗?我更改了顺序,但仍然相同。请添加代码中的所有导入语句我刚刚添加:)您可以尝试更改HomeContent和CardItemContainer的顺序吗拜托,我已经改变了顺序,但还是一样。