How to render nested firebase data in listview with "react-native -
how render nested firebase data in listview react-native
hi ! developing beginner project using firebase
, react-native
. have problem , want give me advice or code on problem.
this firebase data
{"users" : { "firebaserandomkey" : { "isvalid" : true, "name" : "name", "post" : { "posttext" : "lorem ipsum", "posturi" : "https://i.ytimg.com/vi/4hgrifivkqo/maxresdefault.jpg" }, "surname" : "surname", "uri" : "https://i.ytimg.com/vi/oei2sjuoweu/hqdefault.jpg" },}}
this listview renderrow
renderrow(rowdata) { return ( <scrollview containerstyle={styles.scrollview}> <text>{rowdata.name} {rowdata.surname}</text> <image source={{ uri: string(rowdata.uri) }} style={styles.photo} /> <text>{rowdata.posttext}</text> <image source={{ uri: string(rowdata.posturi) }} style= {styles.postphoto} /> </scrollview> ); }
so can not reach posttext
, posturi
because in "post"
. how can reach them in renderrow rowdata
? answers
have change 1 :
<text>{rowdata.posttext}</text>
to 1 :
<text>{rowdata.post.posttext}</text>
and 1 :
<image source={{ uri: string(rowdata.posturi) }} style= {styles.postphoto} />
to 1 :
<image source={{ uri: string(rowdata.post.posturi) }} style= {styles.postphoto} />
Comments
Post a Comment