[英]Objects are not valid as a React child. If you meant to render a collection of children, use an array instead - FlatList
React-native Expo CLI ,FlatList I'm trying use a FlatList. React-native Expo CLI ,FlatList 我正在尝试使用 FlatList。 but its showing me error as-但它向我显示错误为-
faltList code错误列表代码
{
(PostLoaded)?<FlatList
data = {PostData}
keyExtractor = {item => item.key}
renderItem={(itemData) => {
const PostInfo = itemData.item;
// console.log(PostInfo.Name);
return(
<View style={style.petshowContainer}>
<Image source={{uri:PostInfo.Image}}
style={{width:150,height:175,borderTopLeftRadius:10,borderBottomLeftRadius:10,}}
resizeMode='cover'
/>
<View style={{margin:10}}>
<Text style={{fontSize:25}}>{PostInfo.Name}</Text>
<View style={{flexDirection:'row',alignItems:'center'}}>
<Text style={{fontSize:15,marginRight:20}}>{PostInfo.Age}/ {PostInfo.Breed}</Text>
<Button mode='outlined' style={{borderColor:'blue'}}>{PostInfo.Gender}</Button>
</View>
<Text style={{marginBottom:5}}>Available for : </Text>
<Text>{PostInfo.From_Date} - 11/10/2021</Text>
<Button mode="contained" style={{marginTop:10}}>PetME</Button>
</View>
</View>
)
}}
style={{backgroundColor:'red'}}
/>:<Text>loading...</Text>
}
And Post Data is an array contains object received from firebase并且 Post Data 是一个包含从 firebase 接收到的对象的数组
PostData = [{name:"narendra",Age:5.......},{.....}]
这是由于错误的日期格式引起的
<Text>{PostInfo.From_Date} - 11/10/2021</Text>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.