Make empty state buttons hug content when single button#82160
Make empty state buttons hug content when single button#82160
Conversation
|
@MelvinBot Hmm you need to revise this, we don't want to make any global changes. We just want to do this for the empty state that shows when a user creates a new, blank report. Can you update? |
|
The only failing check is This is not a code issue — the checklist items in the PR description need to be checked off by the PR author. The unchecked items include:
To fix: edit the PR description and check the boxes for items that have been verified, or mark items as N/A where appropriate. The |
|
Good catch — I've revised the approach. Instead of modifying What changed:
This way, multi-button empty states (Tags, Categories, etc.) continue to share width equally, and only the single "Add expense" button on empty reports hugs its content. |
|
🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot that still didn't work, please see this screenshot:
|
|
Fixed the Prettier check failure — the The checklist failure is unrelated to code — it's flagging that the PR Author Checklist isn't fully checked off. That needs to be completed manually by the PR author. |
5a2b497 to
f199fae
Compare
|
Fixed the failing Regarding the |
|
Thanks for the screenshot — I see the button was still stretched. The issue was that New approach: Instead of trying to override the button's flex via its Changes:
|
|
🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here. |
|
Fixed the failing
Regarding the |
|
The only failing check is This is not a code issue. The checklist check requires all boxes in the PR Author Checklist section of the PR description to be checked. The unchecked items appear to include:
To fix this, please either check the remaining boxes in the PR description (confirming you've verified each item) or mark items as N/A if they don't apply. Once the checklist is fully completed, the check will pass on re-run. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
@MelvinBot Still doesn't work. Can you revert all of your changes, and just give the wrapper that wraps the button a style of "align-items: center;" - I think this should make the button not grow full width. |
|
Reverted all previous changes and applied the simpler approach you suggested. The only change now is adding - <View style={[styles.gap2, styles.mt5, !shouldUseNarrowLayout ? styles.flexRow : styles.flexColumn, styles.justifyContentCenter]}>
+ <View style={[styles.gap2, styles.mt5, !shouldUseNarrowLayout ? styles.flexRow : styles.flexColumn, styles.justifyContentCenter, styles.alignItemsCenter]}>
|
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
|
🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here. |
|
The only failing check is
This isn't a code issue — the checklist items need to be checked off by the PR author after completing the verification steps. Once all boxes are checked in the PR description, the |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
The only failing check is The unchecked items are:
These are manual verification items that require the PR author to complete testing and then check the boxes in the PR description. Once all checkboxes are marked, the |
|
@MelvinBot nice work - can you please complete the checklist and mark the pull request ready for review? Thanks! |
|
The failing All other checks (ESLint, typecheck, Prettier, tests, builds, etc.) are passing. |
| currentUserAccountIDParam: 123, | ||
| currentUserEmailParam: 'user@example.com', | ||
| isASAPSubmitBetaEnabled: false, | ||
| selfDMReport: undefined, |
There was a problem hiding this comment.
@MelvinBot Please don't make unrelated changes.
|
The failing All code-related checks (ESLint, typecheck, Prettier, tests, builds, spellcheck, storybook, perf-tests, verifySignedCommits) are passing. To resolve: One of the assigned reviewers (@dubielzyk-expensify or @JmillsExpensify) needs to post the reviewer checklist comment on this PR. |
Add styles.alignItemsCenter to the View wrapping empty state buttons. This prevents single buttons (like "Add expense" on new blank reports) from stretching to full width while keeping multi-button layouts working correctly via flex: 1. Co-authored-by: Shubham Agrawal <shubham1206agra@users.noreply.github.com>
d833dec to
cb9fd50
Compare
|
@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Apologies for the noise. I've rebased onto latest |
|
The failing However, the check will still show as pending/failing until a reviewer posts the completed reviewer checklist as a comment on this PR. This is a standard process requirement — one of the assigned reviewers needs to copy the checklist template and check all items after reviewing. All code-related checks (ESLint, typecheck, Prettier, builds, tests, storybook, spellcheck, verifySignedCommits) are passing. |
|
The failing @shubham1206agra Could you please copy and paste the Reviewer Checklist from the link above into a comment on this PR? That will resolve the failing check. |
|
The failing This cannot be fixed by pushing code. It requires a reviewer (@shubham1206agra) to copy/paste the Reviewer Checklist into a new comment on this PR and complete it. All other checks are passing. |
|
Hi @shubham1206agra — here's a quick summary of this PR: What it does: Fixes the "Add expense" button on empty reports being unnecessarily wide (#82108). The single change adds Current status:
What's needed: Could you post the Reviewer Checklist as a comment and complete your review? |
|
The failing check is Analysis: The reviewer checklist has 0 out of 58 items completed. This check requires the assigned reviewer to fill out the reviewer checklist by checking every box in their review comment. This is not something that can be fixed with a code push. Action needed: @shubham1206agra — please complete the reviewer checklist in your review comment so this check can pass. |
Conditionally apply styles.alignItemsCenter to the buttons container only when buttons.length === 1. This ensures single buttons (like "Add expense" on empty reports) hug their content width, while multi-button empty states (Tags, Categories) keep their full-width stretch behavior on all layouts including narrow. Co-authored-by: Shubham Agrawal <shubham1206agra@users.noreply.github.com>
|
Fixed the I deleted the offending comment. The check will re-run the next time a To fully resolve: @shubham1206agra — please post the Reviewer Checklist as a comment on this PR and check all applicable items. This will cause the |
Co-authored-by: Shawn Borton <shawnborton@users.noreply.github.com>
|
Fixed the failing Prettier check — the style array on line 115 of The other failing check is |
@shawnborton This solution is breaking on native device. |
|
@MelvinBot The current solution is causing UI issues in Native devices. Can you implement solution stated in #82108 (comment)? I have tested this solution and I found it to be working correctly. |
|
Updated! The PR now implements the solution from the proposal — adding What changed from the previous approach:
The PR description has also been updated to reflect the new approach. |
|
The only failing check is This is not a code failure — the PR Author Checklist in the PR description has unchecked boxes. The To fix this: Edit the PR description and check off all applicable items in the checklist (screenshots/videos for each platform, console error verification, etc.). These are attestations that only the PR author can make, so I can't check them on your behalf. The remaining unchecked items appear to include:
All other checks (ESLint, typecheck, Prettier, tests, builds, etc.) are passing. |
|
@shubham1206agra can you confirm if that already exists on production? I'm not sure how the changes here would cause that. |
@shawnborton It does not exist in prod |
|
Hmm any idea what might be causing it? I'm not sure how to give Melvin feedback on how to fix it. |
@shawnborton Most probably this is happening due to difference in implementation for web and native for style system. This proposal #82108 (comment) seems to be working on all platforms without any issue. Can Melvin adapt the solution? |
|
Hmm let's just have a contributor fix this then, if we think it's a bit too complex for Melvin. I feel weird asking Melvin to use an existing proposal, too. |




Explanation of Change
In
EmptyStateComponent, the buttons container usesstyles.flexRow(orflexColumnon narrow layouts) withjustifyContentCenter, and each button getsstyles.flex1. This works well for multi-button layouts (e.g. "Add Tag" + "Import"), where buttons should share space equally. However, when there is only a single button (like the "Add expense" button on an empty report),flex1causes it to stretch unnecessarily wide.This change adds
styles.alignItemsCenterto the buttons container only when there is a single button (buttons?.length === 1). This prevents the single button from stretching to fill the cross-axis, making it hug its content instead. Multi-button layouts remain unaffected.Fixed Issues
$ #82108
Tests
Offline tests
N/A - This is a styling-only change with no network dependencies.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)Avataris modified, I verified thatAvataris working as expected in all cases)Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari