0
我有這個JSON,我想顯示在一個ListViewJSON解析在本地做出反應的ListView
{
"ZoneInfo":{
"Name":"Hollywood",
"AttractionsInfo":[
{
"ContentType":"USSShow",
"Availability":"True",
"Name":"Mel's Dinettes ",
"NextShowTime":"1:00PM",
"QueueTime":"",
"ShowTime":"1:00PM, 3:40PM and 6:15PM",
"WeatherStatus":"True"
},
{
"ContentType":"USSShow",
"Availability":"True",
"Name":"Sesame Street Show - When I Grow Up ®",
"NextShowTime":"12:15PM",
"QueueTime":"",
"ShowTime":"12:15PM, 3:00PM and 5:40PM",
"WeatherStatus":"True"
},
{
"ContentType":"USSShow",
"Availability":"True",
"Name":"The Cruisers",
"NextShowTime":"10:45AM",
"QueueTime":"",
"ShowTime":"10:45AM, 2:00PM and 4:45PM",
"WeatherStatus":"True"
},
{
"ContentType":"USSShow",
"Availability":"True",
"Name":"The Minions From Despicable Me ",
"NextShowTime":"12:40PM",
"QueueTime":"",
"ShowTime":"12:40PM, 2:20PM, 4:40PM and 6:40PM",
"WeatherStatus":"True"
},
{
"ContentType":"USSMeetAndGreet",
"Availability":"True",
"Name":"The Walk of Fame",
"NextShowTime":"",
"QueueTime":"",
"ShowTime":"",
"WeatherStatus":"True"
}
]
}
}
節名將從ZoneInfo.Name。每一行的內容將是AttractionsInfo.Name
這是我當前的代碼
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow}
enableEmptySections={true}
renderSectionHeader={this.renderSectionHeader}/>
}
renderRow(rowData: string, sectionID: number, rowID: number) {
return (
<View>
<Text>{sectionID.Name}</Text>
</View>
)
}
renderSectionHeader(sectionData, category) {
return (
<View>
<Text>{category}</Text>
</View>
)
}
我如何能實現我想要什麼?
'this.state.dataSource'在您的代碼中的外觀如何?你如何定義它的價值?請發佈代碼。 – Mila