Hola, estoy tratando de escuchar nuevos mensajes de chat (cuando alguien o yo agregamos un nuevo mensaje de chat) como a continuación. pero no está escuchando consultas en vivo. Por favor ayúdenme a ordenarlo...
async componentDidMount() { this.getChatTexts(); } async getChatTexts() { if (this.state.tripId) { firestore() .collection('Chats') .where('tripId', '==', this.state.tripId) .orderBy('time', 'desc') .onSnapshot({includeMetadataChanges: true}, snapshot => { if (snapshot) { this.setState({chatWindow: true}); var chatmessages = []; snapshot.docChanges().forEach(e => { chatmessages.push(e.doc.data()); }); this.setState({chatMessages: chatmessages}); } }); } }