can anyone tell me? I get an array of messages, through api, it contains id, body, owner name "messages": [ { "id": "1", "createdAt": "2019-10-23T12:58:22.933Z", "body": "Hello", }, .....
How can I write it as an array for giftedchat, what would it be "messages": [ { "_id": "1", "createdAt": "2019-10-23T12:58:22.933Z", "text": "Hello", }, .....
And there are 10 messages, that is, how to iterate over to write values from one array to another
Just for a flatlist, there goes render and selects, name: item.ownername, is there something similar that could be used for messages in gifted chat?
You should map your array to get the same format as needed for GiftedChat
const newArray = messages.map(message => ({ _id: message.id, createdAt: message.createdAt, text: message.body, user: { _id: //user_id, name: //username } }))