Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native (与firebase firestore进行react native gifted chat)发送消息时会显示更多消息_React Native_React Native Gifted Chat - Fatal编程技术网

React native (与firebase firestore进行react native gifted chat)发送消息时会显示更多消息

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

我正在使用chat(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
        }
    }
  }