【发布时间】:2019-08-31 19:46:33
【问题描述】:
我需要在 react native 视图中渲染一个 json 对象中的所有项目,但其中一些不在数组中,也不是单个项目。
这是我的 api:
{
"meta": {
"code": 200,
"message": "success",
"errors": []
},
"data": {
"users": [
{
"userinfo": {
"username": "hesamsameni",
"fullname": "hesam sameni",
"photo": "https://aaa.com/img/hesamsameni.png",
"skills": {
"html": "HTML",
"css": "CSS",
"javascript": "JAVASCRIPT",
"react_native": "REACT NATIVE"
}
}
}
]
}
}
这是我的渲染方法:
render() {
return (
<View>
<FlatList
data={this.state.dataSource}
keyExtractor={(item, index) => index.toString()}
renderItem={({item}) =>
<View>
<Text>{item.fullname}</Text>
<Image source={{uri: item.photo}}/>
<Text>Skills:</Text>
// I need to render all the skills here
</View>
}></FlatList>
</View>
【问题讨论】:
标签: react-native jsx