数据结构示例:
"post": {
"postId": {
"name": ".....",
"data1": "....",
},
"users": {
"userId": {
"username": "....",
"data2"
}
}
是否可以在同一个列表视图中呈现(data1
/ data2
)?
_renderList(lists) {
return(
<View>
<Text>{lists.data1}</Text>
<Text>{lists.data2}</Text>
</View>
)
}
我尝试在构造函数中设置两个ref()
,但它不起作用:
constructor(props){
super(props);
this.state = {
dataSource: new ListView.DataSource({
rowHasChanges: (row1, row2) => row1 !==row2,
}),
}
this.listsRef = firebase.database().ref('post');
this.listsUserRef = firebase.database().ref('users').child(uid)
}