[英]FlatList is not showing anything in React Native
I do have such kind of JSON.我确实有这种 JSON。 I am getting it on my React Native app.
我在我的 React Native 应用程序上得到它。
order:[
{
"id": "00005497",
"order_number": "525522",
"order_result_json": [
{
"key": "Номер",
"value": "25263640253590"
},
{
"key": "Ссылка на скачивание",
"value": "https://play.google.com/store/"
},
{
"key": "Ссылка на лицензию",
"value": "https://google.com"
}
]
}]
I can see that data is coming: alert(JSON.stringify(order.orderResultJson));我可以看到数据来了: alert(JSON.stringify(order.orderResultJson)); this is showing that array is coming.
这表明阵列即将到来。
When I am applying it to my FlatList, it is showing empty space, and if I scrolling page down it is going infinite scroll with empty content.当我将它应用到我的 FlatList 时,它会显示空白空间,如果我向下滚动页面,它会无限滚动并显示空白内容。
My FlatList implementation:我的 FlatList 实现:
<View style={{flex: 1, backgroundColor: 'green'}}>
<FlatList
data={order.orderResult}
renderItem={({item}) => <Text>{item.value}+5</Text>}
keyExtractor={item => item.key}
/>
</View>
Any suggestions?有什么建议么?
Isn't just a typo?不只是笔误吗?
Your code uses data={order.orderResult}
, but your json data contains order_result_json
, and your debugging code with alert uses orderResultJson
您的代码使用
data={order.orderResult}
,但您的 json 数据包含order_result_json
,并且带有警报的调试代码使用orderResultJson
order is an array, so you cannot access order.orderResult . order是一个数组,因此您无法访问order.orderResult 。
2 solutions: 2个解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.