You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-11-11] [$175] Attachments - Image flashes briefly after uploading #103619
Version Number: 9.5.6-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#102852 Email or phone of affected tester (no customers):emady.syed123+sign@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: realme c21y / android 11 App Component: Chat Report View
Action Performed:
Precondition: Have an image larger than 24 MiB in size and less than 50 megapixels in resolution.
On native, the thumbnail's image view uses the image URI as its recyclingKey (BaseImage.native.tsx:55). expo-image clears the view each time that key changes. After you send an attachment, its URI changes twice:
From the cached copy to the remote URL, when the server response replaces the optimistic HTML.
Each change blanks the image until the new source loads, so you see a flash.
Why images over 24 MiB look worse
Large images go through resizeImageIfNeeded. The URI sequence stays the same, so there is no extra swap. But the native branch of createFile returns only uri, name, and type (FileUtils.ts:676-683). It drops the width and height from the resize step. The optimistic HTML then has no size attributes (ReportUtils.ts:7440-7458). So the thumbnail starts at the 200x200 default (ThumbnailImage.tsx:77-78) and jumps to its real size when it loads. That jump can make the flash more visible.
What changes do you think we should make in order to solve the problem?
Close this as a duplicate and fix it through the existing issue. Its PR keys the native thumbnail on the attachment ID, not the URI, so both swaps keep the image on screen. That covers images over 24 MiB too.
Optional follow-up: have the native branch of createFile keep width, height, and size. This removes the 200x200-to-real-size jump for resized images.
What alternative solutions did you explore? (Optional)
None. The existing PR targets the same mechanism.
Open question and related issues
Open question: the attachment-ID fix only works if the server's AddAttachment HTML keeps the client's data-attachment-id. If it doesn't, the key still changes at the remote swap. The PR author reports no flash on iOS and Android, which suggests the ID is kept.
Not reproduced here: this bug is iOS native only, and this run could test only on web.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/103619) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-]Attachments - Image flashes briefly after uploading[/-][+][$175] Attachments - Image flashes briefly after uploading[/+]on Oct 9, 2026
Root cause: After the upload completes, the attachment preview swaps its image source (local thumbnail/placeholder to the remote URL), and the swap remounts or reloads the image, causing a visible flash. Fix approach: Keep a stable image key across the transition and keep showing the local thumbnail until the remote image's onLoad fires, then swap without unmounting. Verification: Upload an image larger than 24 MiB and confirm no flash appears in the attachment preview.
Please re-state the problem that we are trying to solve in this issue.
When uploading an image larger than 24 MiB (and under 50 MP) on iOS/Android, the optimistic thumbnail in the chat message flashes and abruptly snaps its aspect ratio a moment after appearing, unlike images under 24 MiB which render smoothly.
On native platforms, createFile rebuilds the object strictly with uri, name, and type, dropping width and height.
Consequently, when getUploadingAttachmentHtml generates the optimistic HTML tag: https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L7451-L7452
the attributes data-expensify-width and data-expensify-height are omitted ('width' in file is false). ThumbnailImage then falls back to default 200x200 dimensions. Once expo-image asynchronously finishes measuring the local file on disk, setImageDimensions abruptly updates the container width and aspect ratio, causing the visible flash/snap.
What changes do you think we should make in order to solve the problem?
Update createFile in src/libs/fileDownload/FileUtils.ts to preserve width and height:
importtype{Dimensions}from'@src/types/utils/Layout';constcreateFile=(file: File&Partial<Dimensions>): FileObject=>{if(getPlatform()===CONST.PLATFORM.ANDROID||getPlatform()===CONST.PLATFORM.IOS){return{uri: file.uri,name: file.name,type: file.type,width: file.width,height: file.height,};}constclonedFile=newFile([file],file.name,{type: file.type,lastModified: file.lastModified,});// `uri` is a custom property that the File constructor doesn't copy, and attachment previews need itclonedFile.uri=file.uri;if(file.width!==undefined){clonedFile.width=file.width;}if(file.height!==undefined){clonedFile.height=file.height;}returnclonedFile;};
This guarantees that resized native attachments retain their scaled dimensions just like picked images, allowing getUploadingAttachmentHtml to stamp the thumbnail size attributes from the very first frame.
What alternative solutions did you explore? (Optional)
Re-measuring via ImageSize.getSize in ReportUtils: This adds unnecessary async overhead before dispatching optimistic actions and duplicates work already performed by getImageDimensionsAfterResize.
Hiding ThumbnailImage until onLoad: This leads to jarring blank placeholders instead of smooth optimistic thumbnails. Preserving dimensions at source in createFile mirrors the standard unresized attachment flow and provides optimal UX.
Unit / Regression Tests
Unit Tests in tests/unit/FileUtilsTest.ts:
Update createFile native test to assert that width and height are preserved on the cloned object:
Add a test for resizeImageIfNeeded on native verifying that the returned FileObject contains the dimensions returned by the mocked getImageManipulator.
Manual QA:
On iOS / Android, navigate to a DM.
Tap + > Add attachment.
Select an image > 24 MiB (under 50 MP) and tap Send.
Verify the optimistic thumbnail displays immediately with its correct aspect ratio without snapping or flashing.
📣 @jeff-graham-ai! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR:
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
Have a JPEG image larger than 24 MiB and smaller than 50 megapixels.
Android: Native / iOS: Native
Test:
Launch the app and sign in.
Open a DM conversation.
Tap + → Add attachment.
Select the image larger than 24 MiB.
Send the image.
Verify the image thumbnail appears with the correct aspect ratio immediately.
Activity
applause-bot commentedon Oct 9, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/1011d42c8480541fd3df81aca2090d01e7f1a154f526a0f6b5792a0bb3ba0289
https://platform.applause.com/services/links/v1/external/2fee2981b3218fa89b55f403453b65a76398ededd5911f018dab288e78978bbd
MelvinBot commentedon Oct 9, 2026
Proposal
This looks like a duplicate of [$175] Image thumbnail flickers after sending an attachment on iOS and Android. That issue has an open fix in Key native attachment thumbnails on the attachment ID so they stay on screen after send. The 24 MiB size is not the cause. Small images flash the same way.
What is the root cause of that problem?
On native, the thumbnail's image view uses the image URI as its
recyclingKey(BaseImage.native.tsx:55).expo-imageclears the view each time that key changes. After you send an attachment, its URI changes twice:useCachedAttachmentSource.ts:98-102).Each change blanks the image until the new source loads, so you see a flash.
Why images over 24 MiB look worse
Large images go through
resizeImageIfNeeded. The URI sequence stays the same, so there is no extra swap. But the native branch ofcreateFilereturns onlyuri,name, andtype(FileUtils.ts:676-683). It drops thewidthandheightfrom the resize step. The optimistic HTML then has no size attributes (ReportUtils.ts:7440-7458). So the thumbnail starts at the 200x200 default (ThumbnailImage.tsx:77-78) and jumps to its real size when it loads. That jump can make the flash more visible.Endless spinner when uploading image, the PR under QA here, changed only the web branch of
createFile. It did not cause this iOS bug.What changes do you think we should make in order to solve the problem?
createFilekeepwidth,height, andsize. This removes the 200x200-to-real-size jump for resized images.What alternative solutions did you explore? (Optional)
None. The existing PR targets the same mechanism.
Open question and related issues
AddAttachmentHTML keeps the client'sdata-attachment-id. If it doesn't, the key still changes at the remote swap. The PR author reports no flash on iOS and Android, which suggests the ID is kept.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/103619)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Oct 9, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @marufsharifi (
External)[-]Attachments - Image flashes briefly after uploading[/-][+][$175] Attachments - Image flashes briefly after uploading[/+]melvin-bot commentedon Oct 9, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022108591114737543833
yuvrajangadsingh commentedon Oct 9, 2026
withdrawing this, it went up before the issue had the
Help Wantedlabel. will come back if the label is added.khizzcr7 commentedon Oct 9, 2026
Proposal
Root cause: After the upload completes, the attachment preview swaps its image source (local thumbnail/placeholder to the remote URL), and the swap remounts or reloads the image, causing a visible flash.
Fix approach: Keep a stable image key across the transition and keep showing the local thumbnail until the remote image's onLoad fires, then swap without unmounting.
Verification: Upload an image larger than 24 MiB and confirm no flash appears in the attachment preview.
janiya2 commentedon Oct 9, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When uploading an image larger than 24 MiB (and under 50 MP) on iOS/Android, the optimistic thumbnail in the chat message flashes and abruptly snaps its aspect ratio a moment after appearing, unlike images under 24 MiB which render smoothly.
What is the root cause of that problem?
For images exceeding
CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE(24 MiB), the app executesresizeImageIfNeededviauseFilesValidation.Inside
resizeImageIfNeeded:https://github.com/Expensify/App/blob/main/src/libs/fileDownload/FileUtils.ts#L697-L700
getImageManipulatorresizes the image and returns aFileObjectcontaininguri,width, andheight:https://github.com/Expensify/App/blob/main/src/libs/fileDownload/getImageManipulator/index.native.ts#L7-L14
However,
resizeImageIfNeededthen passes this result throughcreateFile(file). IncreateFile:https://github.com/Expensify/App/blob/main/src/libs/fileDownload/FileUtils.ts#L676-L683
On native platforms,
createFilerebuilds the object strictly withuri,name, andtype, droppingwidthandheight.Consequently, when
getUploadingAttachmentHtmlgenerates the optimistic HTML tag:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L7451-L7452
the attributes
data-expensify-widthanddata-expensify-heightare omitted ('width' in fileis false).ThumbnailImagethen falls back to default 200x200 dimensions. Onceexpo-imageasynchronously finishes measuring the local file on disk,setImageDimensionsabruptly updates the container width and aspect ratio, causing the visible flash/snap.What changes do you think we should make in order to solve the problem?
createFileinsrc/libs/fileDownload/FileUtils.tsto preservewidthandheight:https://github.com/Expensify/App/blob/main/src/libs/fileDownload/FileUtils.ts#L676-L691
This guarantees that resized native attachments retain their scaled dimensions just like picked images, allowing
getUploadingAttachmentHtmlto stamp the thumbnail size attributes from the very first frame.What alternative solutions did you explore? (Optional)
ImageSize.getSizeinReportUtils: This adds unnecessary async overhead before dispatching optimistic actions and duplicates work already performed bygetImageDimensionsAfterResize.ThumbnailImageuntilonLoad: This leads to jarring blank placeholders instead of smooth optimistic thumbnails. Preserving dimensions at source increateFilemirrors the standard unresized attachment flow and provides optimal UX.Unit / Regression Tests
tests/unit/FileUtilsTest.ts:createFilenative test to assert thatwidthandheightare preserved on the cloned object:resizeImageIfNeededon native verifying that the returnedFileObjectcontains the dimensions returned by the mockedgetImageManipulator.+>Add attachment.janiya2 commentedon Oct 9, 2026
Contributor details:
camesenin commentedon Oct 13, 2026
melvin-bot commentedon Oct 13, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
28 remaining items
melvin-bot commentedon Nov 8, 2026
📣 @jeff-graham-ai! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
marufsharifi commentedon Nov 9, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR:
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
Android: Native / iOS: Native
Test:
Do we agree 👍 or 👎
melvin-bot commentedon Nov 10, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Nov 10, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Nov 16, 2026
Payment Summary
Contributor+: @marufsharifi due $175 via Upwork