(react-native-gifted-chat with firebase-firestore)发送一条消息时会显示更多消息

(react-native-gifted-chat with firebase-firestore) more messages are displayed when sending one

我正在制作一个带有聊天 (react-native-gifted-chat) 和 firebase-firestore 的应用程序,我在展示它们时遇到了问题,因为当我发送消息时,它们会重复它们已经发送的内容,但它是仅通过数据可视化即可 怎么解决的?

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
        }
    }
  }