我有以下 json 结构
{
"title": "Name(s)",
"type": "Text",
"data": [
{
"source": "DB",
"title": "All",
"list": [
{
"name": "ABCD",
"count": 1
},
{
"name": "BCDE",
"count": 1
},
{
"name": "CDEF",
"count": 1
},
{
"name": "DEFG",
"count": 2
},
{
"name": "EFGH",
"count": 1
}
]
}
]
},
{
"title": "Category(s)",
"type": "Text",
"data": [
{
"source": "DB",
"title": "All",
"list": [
{
"name": "Vegetables",
"count": 1942
},
{
"name": "Saloon",
"count": 355
},
{
"name": "General Store",
"count": 331
},
{
"name": "Restaurants",
"count": 130
},
{
"name": "Fast Food",
"count": 108
}
]
}
]
}
我正在尝试将数据显示为 Like
第 1 节标题:“姓名”第 1 行
:“ABCD”
第 2 行“BCDE”
第 3 行“CDEF”
。
.
.
第 2 部分标题:“类别”第 1 行:“蔬菜”
第 2 行“轿车”第 3 行“
杂货店”
。
.
.
在这里,我是否应该使用 SectionList/Flatlist/ 混合它们来获得上述结果。
在 flatlist/sectionlist 中,我在 renderSectionHeader 中获取部分标题名称和类别,但在 renderItem 中,如何循环对象的“列表”数组。请告诉我