Repository navigation
[WIP] feat: Allow pasting multiple files of any type into the composer - #86677
chrispader wants to merge 25 commits into
Conversation
|
|
onPaste event for text based content and no filesonPaste event for text based content and no files
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
Okay so here's a quick update after working on this follow-up for the recently reverted Multi file clipboard paste PR: In general, it is already possible to paste multiple files of any data type to the clipboard on both Android and iOS, but there are some caveats that i'm still working on and haven't found a holistic solution yet: iOS
Android
|
onPaste event for text based content and no filesThe new-file headers used `diff --git b/... b/...`, which patch-package cannot parse, so postinstall failed on a fresh install. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rewrite the TextInput onPaste patch so native code resolves each pasted file's MIME type, name and size, copies it to a temporary file, and only then calls onPaste. iOS reads pasteboard item providers, and Android uses OnReceiveContentListener, which also receives images from the keyboard's clipboard. Text always goes through the default paste, and only inputs with an onPaste callback handle files. The Composer passes the files straight to the attachment flow, so the getFileSize lookup and the react-native-fs patch it needed are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
react-native-live-markdown replaces the text view's delegate and only forwards `textInputDidPaste:`, so the composer never received pasted files. Use that method name. Also treat items from the Files app as files on iOS 26, which marks them with com.apple.DocumentManager.FINode.File, and items offered for opening in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ContentInfo.releasePermissions()` is not part of the public SDK, so ReactAndroid failed to compile. The copy task already holds on to the content until the files are copied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge of main rebuilt them from outdated dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ReportActionCompose and ConciergePromptBox tests still pasted the old items payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pasting into the composer on iOS and Android only picks up one file. iOS only accepts images, so a PDF copied from the Files app never arrives, and neither platform keeps the original file name. This PR lets the composer receive every pasted file of any type with its original name, MIME type and size. Text still pastes as text.
@dangrous @MonilBhavsar @grgia @parasharrajat
Explanation of Change
The React Native
onPastepatch now sends afilesarray with theuri,type,nameandsizeof each pasted file. It copies every file to a temporary file first, so the file stays readable after the clipboard changes. On iOS it reads the pasteboard's item providers and keeps the name the source app suggests, like the document name from Files orIMG_0002.jpegfrom Photos. On Android it usesOnReceiveContentListenerand reads the name and type from the content provider. The listener also receives images that keyboards like Gboard insert from their clipboard.The patch skips content that has neither a known type nor a file name, and only inputs with an
onPastecallback handle files. Text never reachesonPaste, so pasting text keeps the keyboard open. That was the regression in #86578. The composer passes the files straight to the existing attachment flow.Fixed Issues
$
PROPOSAL:
Tests
iOS: Native
Prerequisite: the Files app has a PDF and a CSV file in the same folder.
Android: Native
Prerequisite: Gboard is the keyboard.
Offline tests
QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari