我无法解决与 SectionList - React-native 组件相关的问题。
这是我的数据结构:
[
{
id: 'newKey1',
image: '',
title: 'Men Clothing',
subCategory: [
{
id: 'key1',
displayName: 'value1',
image: '',
},
{
id: 'key2',
displayName: 'value2',
image: '',
},
],
},
{
id: 'newKey2',
image: '',
title: 'Women Clothing',
subCategory: [
{
id: 'key1',
displayName: 'value1',
image: '',
},
{
id: 'key2',
displayName: 'value2',
image: '',
},
{
id: 'key3',
displayName: 'value3',
image: '',
},
],
},
];
我正在尝试实现 SectionList,data
上面的 const 值在哪里传递。
return (
<View style={styles(theme).container}>
<AdBanner />
<SectionList sections={data} />
</View>
);
但我得到一个错误:未定义不是对象(评估'Items.Length')
请帮助并分享可能的解决方案谢谢