React native 本机基本缩略图不接受图像源
我正在使用native base显示缩略图源代码,我收到错误消息React native 本机基本缩略图不接受图像源,react-native,native-base,React Native,Native Base,我正在使用native base显示缩略图源代码,我收到错误消息 Error: The <Image> component cannot contain children. If you want to render content on the top of the image, consider using the <ImageBackground> component or absolute positioning. 错误:组件不能包含子组件。如果您想在图像的顶部
Error: The <Image> component cannot contain children. If you want to render content on the top of the image, consider using the <ImageBackground> component or absolute positioning.
错误:组件不能包含子组件。如果您想在图像的顶部渲染内容,请考虑使用组件或绝对定位。
这是我尝试过的错误:
import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { Card, CardItem, Thumbnail, Body, Left, Right, Button, Icon } from 'native-base';
class CardComponent extends Component {
render() {
return (
<Card>
<CardItem>
<Left>
<Thumbnail source={require('../assets/me.png')}>
<Body>
<Text>Username</Text>
<Text note>August 29, 2018</Text>
</Body>
</Thumbnail>
</Left>
</CardItem>
</Card>
);
}
}
import React,{Component}来自'React';
从“react native”导入{View,Text,StyleSheet};
从“本机基础”导入{卡片、卡片、缩略图、正文、左、右、按钮、图标};
类CardComponent扩展组件{
render(){
返回(
用户名
2018年8月29日
);
}
}
试试这个,这个对你有用
<Card>
<CardItem>
<Left>
<Thumbnail source={require('../assets/me.png')}/>
<Body>
<Text>Username</Text>
<Text note>August 29, 2018</Text>
</Body>
</Left>
</CardItem>
</Card>
用户名
2018年8月29日
试试这个,这个对你有用
<Card>
<CardItem>
<Left>
<Thumbnail source={require('../assets/me.png')}/>
<Body>
<Text>Username</Text>
<Text note>August 29, 2018</Text>
</Body>
</Left>
</CardItem>
</Card>
用户名
2018年8月29日
使用
标记将文本附加到图像上
请参阅此使用
标记将文本附加到图像上
请参阅此您不能将标记放在标记缩略图为本地图像的一侧。图像不能有子对象,因此,如果要用缩略图包装文本,请将其替换为ImageBackground并自行应用缩略图样式。标记缩略图为本机图像的一侧不能有标记。图像不能有子对象,所以如果要使用缩略图包装文本,请将其替换为ImageBackground,然后自己应用缩略图样式