React native (与firebase firestore进行react native gifted chat)发送消息时会显示更多消息
我正在使用chat(react native gifted chat)和firebase firestore制作一个应用程序,在显示它们时我遇到了一个问题,因为当我发送消息时,它们会重复它们已经发送的内容,但只有通过数据才可视,这是正常的 怎么解决呢?React native (与firebase firestore进行react native gifted chat)发送消息时会显示更多消息,react-native,react-native-gifted-chat,React Native,React Native Gifted Chat,我正在使用chat(react native gifted chat)和firebase firestore制作一个应用程序,在显示它们时我遇到了一个问题,因为当我发送消息时,它们会重复它们已经发送的内容,但只有通过数据才可视,这是正常的 怎么解决呢? if(doc._id === this.state.user.uid){ messages = { _id: Math.round(Math.random() * 1000000), // () => hacia
if(doc._id === this.state.user.uid){
messages = {
_id: Math.round(Math.random() * 1000000), // () => hacia quien se envia
createdAt: new Date(doc.createdAt.seconds * 1000),
text: doc.text,
user: {
_id: this.state.uid2, // quien lo envia => ()
name: this.state.chat
}
}
} else {
messages = {
_id: Math.round(Math.random() * 1000000),
createdAt: new Date(doc.createdAt.seconds * 1000),
text: doc.text,
user: {
_id: this.state.user.uid,
name: this.state.user.displayName
}
}
}