Hello,
I’m using @sendbird/chat 4.0.4 on react-native 0.63.4 based app.
On the latest project, I need to implement file upload on chat, so I added this logic:
const messageAttachmentParams: FileMessageCreateParams[] = messageAttachments.map(
attachment => {
const { uri, name, size, type } = attachment;
const param: FileMessageCreateParams = {
pushNotificationDeliveryOption: PushNotificationDeliveryOption.DEFAULT,
file: {
name,
uri,
type,
},
fileName: name,
mimeType: type as string,
fileSize: size as number,
thumbnailSizes: [{ maxWidth: 200, maxHeight: 200 }],
};
return param;
},
);
channel
.sendFileMessages(messageAttachmentParams)
.onPending((message: SendableMessage) => {
console.log("onPending", message);
})
.onSucceeded((message: SendableMessage) => {
console.log("onSucceed", message);
})
.onFailed((error: Error) => {
console.log("onFailed", error);
});
After that, onSucceeded
was called as expected, and a receiver could see the file message sent, but nothing appeared on sender screen. (the message was displayed after reloading chat data)
Do I need to do anything else after sending file messages?
And one more, how can I get file transmission progress? I remember that v3 has fileProgressHandlerCallback
, but I couldn’t find anything on v4. it looks onPending
does not return actual progress.