0
Whoa, that’s all right?
I’m doing a college project using the Firebase and the React Native.
I developed a screen where I want to publish texts and show everyone who is using the application. I was able to save the data in the database, but I can’t show it on the screen.
This is called to read the database data:
listarPub() {
const publicadas = firebase.database().ref('Publicacoes').child('publicacao');
publicadas.on('value', (snapshot) => {
this.setState({ publicadas: snapshot.val()});
});
}
However, I have no idea how to apply in a Text
and/or FlatList
for example.
I wonder if this flame is correct and how do I show it on the screen. I tried several topics, videos, etc, but I could not get anything to help me.
NOTE: It’s my first post here, so I don’t know how to express myself right is my first experience with React and Firebase.
Thank you!
Hi Murilo. So, I did this way and still not returned. I created a console log: console.log(published.on('value', (snapshot) => { this.setState({ published: snapshot.val() }); and returns as [Function Anonymous]. Can you help me with that?
– Thayná Rodrigues
can add error log from red screen?
– Murilo Medeiros
It does not error, but does not return the database posts. There is something I can do to clarify better the reason for not returning the data?
– Thayná Rodrigues