Skip to content

[Due for payment 2026-10-13] [$175] Report Preview Buttons Are Not Split 50/50 #101797

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.91-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @shawnborton
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Navigate to a report that is displayed as a preview.
  2. Locate the action buttons at the bottom of the report preview.
  3. Observe the width and alignment of the buttons. (Submit and View)

Expected Result:

The two buttons should each occupy 50% of the available width, providing an evenly split layout.

Actual Result:

The green button expands to fill the available space, while the other button only takes up the width of its content and appears to hug the text.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Image Image Image

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 21, 2026
  2. MelvinBot commented on Sep 21, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The two buttons are laid out in ReportPreviewActionButton.tsx:64-69, and the row is asymmetric: the primary button is wrapped in a View carrying styles.flex1, while viewButton is dropped into the same flexRow bare.

    styles.flex1 resolves to flex-grow: 1; flex-shrink: 1; flex-basis: 0%, so the primary button claims all free space. The "View" button, built at ReportPreviewActionButton.tsx:25-32 with no style prop, falls back to flex: 0 1 auto and sizes to its text. Nothing else in the row constrains width — styles.reportPreviewActionRow only sets height: 40, and buttonMaxWidth only caps the row.

    This is why the bug appears only when a primary action exists. The no-primary branch at ReportPreviewActionButton.tsx:61 uses a column container, so "View" stretches full width there and looks correct.

    Introduced by Navigate to the clicked expense in a multi-expense report preview (v2) (merged 2026-09-07), which added the second button to a row that previously held only one.

    What changes do you think we should make in order to solve the problem?

    Give the "View" button the same flex treatment as the primary one, in src/components/ReportActionItem/MoneyRequestReportPreview/ReportPreviewActionButton.tsx: pass styles.flex1 as the style prop on the Button at line 26. Both children then resolve to flex: 1 1 0% and each gets (rowWidth − 8px gap) / 2.

    style is the correct prop here — Button forwards it to the outermost OpacityView (Button.tsx:150-155), which is the flex child. Do not change the no-primary branch at line 61.

    Supporting detail

    Canonical 50/50 pattern already used elsewhere — a flexRow + gap2 container where every child Button carries style={styles.flex1} itself:

    Why the primary button keeps its wrapper View. AnimatedSubmitButton accepts no style or wrapperStyle prop at all (AnimatedSubmitButton/index.tsx:24-46), so it only fills width because the parent View stretches it. Removing that wrapper to match the canonical pattern would break Submit and Approve.

    Alternative considered: wrap viewButton in its own <View style={[styles.flex1]}>. Same visual result and symmetric with the primary, but it adds a node where the Button already exposes a working style prop.

    Alternative rejected: setting a fixed width: '50%' on both. That fights the existing gap: 8 and overflows the row.

    Side effect to check in QA: the primary button drops from roughly 75% to 50% of the row, so long labels such as "Pay $1,234.56 elsewhere" may now truncate — Button.Text defaults to numberOfLines={1} (ButtonText.tsx:23).

    Tests: tests/ui/components/ReportPreviewActionButtonTest.tsx:127-137 only inspects the outer container, so it will not catch this. Worth extending it to assert both children carry flex1.

    Not reproduced in a live session — the conclusion rests on reading the source plus the screenshots in the report, which match the predicted layout exactly.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/101797) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 21, 2026
  4. melvin-bot commented on Sep 21, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

  5. melvin-bot commented on Sep 21, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  6. shawnborton commented on Sep 21, 2026

    @shawnborton
    Contributor

    Any thoughts on this one @wildan-m ?

  7. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    @parasharrajat Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  8. parasharrajat commented on Sep 25, 2026

    @parasharrajat
    Member

    @shawnborton Do you want me to go ahead with the fix?

  9. parasharrajat commented on Sep 26, 2026

    @parasharrajat
    Member
  10. MelvinBot commented on Sep 26, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: Split report preview action buttons evenly
    Please mark it as "Ready for review" when it is ready for review.

    The fix gives the "View" button styles.flex1, matching the primary button, so the two buttons now split the row 50/50. I also added a unit test for the even split.

    Verification
    • Web (dev NewDot): Approve is about 146px and View about 145px of a 301px row. Clicking View still opens the report.
    • Passed: the targeted Jest test (9/9), typecheck, lint-changed, and spell-changed.
    • Not run here: the React Compiler check, full npm test, and the Storybook smoke test.
    Report preview card with Approve and View buttons split evenly

    Heads-up for QA: the primary button shrinks from about 75% to 50% of the row, so long labels (for example, "Pay $1,234.56 elsewhere") may truncate.

  11. 22 remaining items

  12. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Oct 7, 2026
  13. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  14. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  15. mallenexpensify commented on Oct 15, 2026

    @mallenexpensify
    Contributor

    Deploy Blocker #103169 was identified to be related to this PR.

    @parasharrajat this issue and/or PR mention a deploy blocker or a regression. Before the payment date, post one of the three options in step 20 of the C+ doc: it was a regression, it was not, or you did not review the offending PR. If you don't post, the default is to reduce payment.

  16. parasharrajat commented on Oct 15, 2026

    @parasharrajat
    Member

    it was a regression.

  17. mallenexpensify commented on Oct 16, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @parasharrajat due $100 via NewDot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions