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 2025-11-19] [$250] Scan - receipt picture not display full image as seen at the time of capture #71644
Version Number: v9.2.21-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail:https://test-management.browserstack.com/projects/2219752/test-runs/TR-1105/folder/13176933/41237723/927170986 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Device used: iPhone 16 pro/ 18.6.2 App Component: Money Requests
Action Performed:
Precondition: Open file PDF on computer
Open app
Navigate to any conversation or workspace chat
Tap on + button and select Create expense
Tap on Scan tab
Rotate your phone to landscape mode
Adjust for seen image on computer with largest and fully
Take photo
Tap on receipt picture
Expected Result:
The image displays fully as seen in the viewfinder at the time of capture
Actual Result:
The image is cut off, not display fully as seen at the time of capture
/** Width portion of the target aspect ratio (e.g., 16 for 16:9) */
aspectRatioWidth?: number,
/** Height portion of the target aspect ratio (e.g., 9 for 16:9) */
aspectRatioHeight?: number,
/** Vertically align the crop to the top (true) or center (false) */
shouldAlignTop?: boolean,
): Promise<ImageObject>{
But we haven't taken into account that the preview container (defined by aspectRatioWidth and aspectRatioHeight) can also be rotated (just like image). In this case, even after rotating, the preview container width and height remain the same (it should be exchanged width >> height and height >> width).
What changes do you think we should make in order to solve the problem?
This issue only happens on Android and iOS, on Web, the container size after rotation is automatically handled. The general idea is simple: If the photo is rotated, we need to switch the viewport width and height:
iOS uses RN built-in Image.getSize which only provides width and height. So we need to rely on the photo.orientation returned by react-native-vision-camera:
- `portrait`: **0°** (home-button at the bottom)
- `landscape-left`: **90°** (home-button on the left)
- `portrait-upside-down`: **180°** (home-button at the top)
- `landscape-right`: **270°** (home-button on the right)
Web is same as iOS (no rotation support) but it already auto handles the width/height switching for the view container so we can ignore it.
So based on that, we need to create platform-specific files isRotated that determines rotation:
changed the title [-]Scan - receipt picture not display full image as seen at the time of capture[/-][+][$250] Scan - receipt picture not display full image as seen at the time of capture[/+]on Oct 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.54-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@truph01@strepanier03 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Het @strepanier03 I'm paid via NewDot now so I'll request later on due date. Matt Allen also told me to link this internal GH in case the automatic offer has been sent. Thank you
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Test on mobile only
Rotate your phone to landscape mode (make sure device's rotation lock is not enabled)
FAB -> Create expense -> Scan
Grant camera permission if needed
Press capture
Press the receipt preview
Verify what you saw on the camera preview in step 4 is captured fully in the receipt
Activity
melvin-bot commentedon Oct 1, 2025
Triggered auto assignment to @strepanier03 (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.gijoe0295 commentedon Oct 1, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Receipt picture not display full image as seen at the time of capture
What is the root cause of that problem?
After capturing the photo, we try to crop it to exactly fit in the preview container in this function:
App/src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts
Lines 37 to 49 in 0bca8fe
But we haven't taken into account that the preview container (defined by
aspectRatioWidthandaspectRatioHeight) can also be rotated (just like image). In this case, even after rotating, the preview container width and height remain the same (it should be exchanged width >> height and height >> width).What changes do you think we should make in order to solve the problem?
This issue only happens on Android and iOS, on Web, the container size after rotation is automatically handled. The general idea is simple: If the photo is rotated, we need to switch the viewport width and height:
The problem is
isRotated.rotationvalue returned byreact-native-image-size:App/src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts
Line 50 in 0bca8fe
That is already working:
App/src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts
Line 52 in 0bca8fe
Image.getSizewhich only provideswidthandheight. So we need to rely on thephoto.orientationreturned byreact-native-vision-camera:App/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx
Line 677 in 76c9fdb
orientationcan have these values:rotationsupport) but it already auto handles the width/height switching for the view container so we can ignore it.So based on that, we need to create platform-specific files
isRotatedthat determinesrotation:0App/src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts
Line 52 in 0bca8fe
Then pass those actual
ratioWidthandratioHeighttocalculateCropRect:App/src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts
Line 60 in 0bca8fe
What alternative solutions did you explore? (Optional)
None
[-]Scan - receipt picture not display full image as seen at the time of capture[/-][+][$250] Scan - receipt picture not display full image as seen at the time of capture[/+]melvin-bot commentedon Oct 7, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021975356266177322593
melvin-bot commentedon Oct 7, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @truph01 (
External)strepanier03 commentedon Oct 7, 2025
Able to repro okay.
34 remaining items
melvin-bot commentedon Nov 12, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Nov 12, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.54-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-11-19. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Nov 12, 2025
@truph01 @strepanier03 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
strepanier03 commentedon Nov 19, 2025
Payment Summary
gijoe0295 commentedon Nov 19, 2025
Het @strepanier03 I'm paid via NewDot now so I'll request later on due date. Matt Allen also told me to link this internal GH in case the automatic offer has been sent. Thank you
truph01 commentedon Nov 19, 2025
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
strepanier03 commentedon Nov 21, 2025
Thanks for letting me know @gijoe0295 - I ended the contract in Upwork, so it's not sitting in your dashboard.
I updated the payment summary and removed the hold.
JmillsExpensify commentedon Nov 26, 2025
$250 approved for @gijoe0295