CrazyCodeBoy老湿,我昨天试了下SectionList,传了个datasouce进去,结果报'Cannot read property 'reduce' of undefined',我的rn版本是0.43,啥情况呢let food = [
{name: "Lettuce", category: "Vegetable"},
{name: "Apple", category: "Fruit"},
{name: "Orange", category: "Fruit"},
{name: "Potato", category: "Vegetable"}
];
export default class XYRecycle extends Component{
constructor(props){
super(props);
let ds = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2,
sectionHeaderHasChanged: (s1, s2) => s1 !== s2
});
this.state={
result:'',
dataSource:ds.cloneWithRowsAndSections(this.convertFoodArrayToMap()),
};
}
convertFoodArray