Skip to content

Commit 5a317fd

Browse files
docs(sdk/react-native): align upload-files with UploadFileRequest API
Rewrite the React Native "Upload Files" guide to the request-object upload API the RN SDK actually ships (CometChat.createUploadFileRequest -> UploadFileRequest), mirroring the JS SDK guide (PR #427) section-for-section. The previous draft documented a functional CometChat.uploadFiles() surface that does not exist in @cometchat/chat-sdk-react-native. - upload-files.mdx: createUploadFileRequest + UploadFileRequest, caller- supplied fileId, UploadFileListener.onFileProgress, UploadResult.batchId, getAttachments/getAttachmentsByType/getStatus (IN_PROGRESS/IDLE), addUploadListener, removeAttachment, clearAll, getMaxAttachmentCount(). Retry documented as re-upload of the same fileId (RN has no retryAttachment()); RN-specific error codes added (ERR_UNAUTHENTICATED, ERR_PRESIGN_REJECTED, ERR_PRESIGN_FETCH_FAILED). - send-message.mdx: fix phantom-API references — getFileUploadLimits() -> getMaxAttachmentCount(), uploadFiles() -> UploadFileRequest. - docs.json: add the upload-files page to RN Messaging nav. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f08f449 commit 5a317fd

3 files changed

Lines changed: 365 additions & 3 deletions

File tree

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3521,6 +3521,7 @@
35213521
"group": "Messaging",
35223522
"pages": [
35233523
"sdk/react-native/send-message",
3524+
"sdk/react-native/upload-files",
35243525
"sdk/react-native/receive-messages",
35253526
"sdk/react-native/additional-message-filtering",
35263527
"sdk/react-native/retrieve-conversations",

sdk/react-native/send-message.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,16 @@ mediaMessage.setQuotedMessageId(10);
437437

438438
## Multiple Attachments in a Media Message
439439

440-
Starting version 3.0.9 & above, the SDK supports sending multiple attachments in a single media message. There are two ways:
440+
Starting version 3.0.9 & above, the SDK supports sending multiple attachments in a single media message. A media message can carry up to a configurable maximum number of attachments (default **10**, controlled by the `file.count.max` app setting). `sendMediaMessage()` rejects with `ERR_FILE_COUNT_EXCEEDED` if you exceed it — read the current limit at runtime with `CometChat.getMaxAttachmentCount()`.
441441

442-
1. **By providing an array of files** — Pass an array of file objects and CometChat uploads them automatically.
443-
2. **By providing URLs** — Use the [`Attachment`](/sdk/reference/auxiliary#attachment) class with multiple URLs.
442+
<Tip>
443+
**Recommended: upload first, then send.** For a real composer — where you want a progress bar per file, and the ability to remove or retry individual files — upload the files through an [`UploadFileRequest`](/sdk/react-native/upload-files), collect the resulting `Attachment`s, and attach them here with `setAttachments()`. This decouples the (slow, cancellable) upload from the (instant) send. See [Upload Files & Send Attachments](/sdk/react-native/upload-files) for the full flow.
444+
</Tip>
445+
446+
There are two ways:
447+
448+
1. **By providing an array of files** — Pass an array of file objects and CometChat uploads them automatically. This is the simplest path, but it gives no upload progress and no per-file cancel/retry — for that, [upload first](/sdk/react-native/upload-files).
449+
2. **By providing URLs** — Use the [`Attachment`](/sdk/reference/auxiliary#attachment) class with multiple URLs. This is also the path the [upload-then-send flow](/sdk/react-native/upload-files) uses — the `Attachment`s from an `UploadFileRequest` are ready to pass straight to `setAttachments()`.
444450

445451
### Upload Multiple Files
446452

0 commit comments

Comments
 (0)