【发布时间】:2021-05-18 14:54:02
【问题描述】:
我是 react-native 的新手,我有这些数据,我想在我的 Flatlist 中获取 privateUrl。
console.log(information)
返回:
{
"images": [
{
"_id": "60a39eda33c50c377afd9cef",
"name": "155055995_4635322536484663_1177699315069654339_n.jpg",
"sizeInBytes": 677009,
"publicUrl": null,
"privateUrl": "tenant/607b7b33b168410028b2a095/informations/images/dad8915d-2292-4a9a-be2e-1b2fe711069f.jpg",
"updatedAt": "2021-05-18T14:07:42.859Z",
"createdAt": "2021-05-18T14:07:42.859Z",
"id": "60a39eda33c50c377afd9cef",
"downloadUrl": "http://172.16.224.151:8080/api/file/download?privateUrl=tenant/607b7b33b168410028b2a095/informations/images/dad8915d-2292-4a9a-be2e-1b2fe711069f.jpg"
}
],
"email": null,
"site_web": "https://www.git-tower.com/learn/git/faq/solve-merge-conflicts/",
"num_Tel": null,
"type": "news",
"publish": "true"
}
这是我的平面列表:
<FlatList
data={information}
windowSize={60}
initialNumToRender={6}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item, index }) => (
<HotelItem
block
image={image}
name={item.titleFR}
location={item.createdAt}
style={{ marginLeft: 15, marginBottom: 15 }}
onPress={() => {
/* 1. Navigate to the Details route with params */
navigation.navigate('HotelDetail', {
infoId: item._id,
});
}}
/>
)}
/>
我想在我的平面列表中获取 privateUrl,我尝试了这个:
image={item.images.privateUrl}
但不工作。
【问题讨论】:
标签: reactjs react-native react-native-flatlist