convert all array object(firestore timestamp) to date

后端 未结 2 523
名媛妹妹
名媛妹妹 2021-01-26 15:29

I am using firestore and react-native-gifted-chat, I am trying to get all the chat messages from firestore to the chat. However, gifted chat does not support displaying firebase

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-26 15:58

    Sorry for not explore deeply, after checking @Spatz comments I figure out how to do it

    documentData.forEach(a => {
      var date = a.createdAt.toDate()
      data.push({
        _id: a._id,
        createdAt: date,
        id: a.id,
        text: a.text,
        user: a.user
      })
    })
    

提交回复
热议问题