New Feature: Add Make splits even functionality#73474
Conversation
|
@parasharrajat 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] |
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report❌ Patch coverage is
... and 366 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@parasharrajat Please hold on reviewing until we get answers to this comment. |
|
Better to clarify on issue @ikevin127 |
Let's update to the OP design. We're going to be working on some changes in quick follow ups that require it:
That's correct. This button shouldn't appear/disappear based on the split amounts, it should always be there, even if it doesn't do anything when the splits are already even. |
Split evenly functionalityMake splits even functionality
|
Hey, I noticed you changed Please look at the code and make sure there are no malicious changes before running the workflow. If you have the K2 extension, you can simply click: [this button] |
|
@Expensify/design PR was updated to match design UI / functionality. Please review the updated videos and let me know if there are any spacing concerns / changes needed - so otherwise @parasharrajat can start reviewing! 🙌 |
| sections[0].data.filter((item) => { | ||
| if (isSelected) { | ||
| return isSelected(item); | ||
| ((sections?.[0]?.data ?? []) as unknown[]).filter((item): item is TItem => { |
There was a problem hiding this comment.
Please don't infer type to unknown correct the type instead.
There was a problem hiding this comment.
Reverted the changes as I went with using listFooterContent (thanks for that), so this type mess is not needed anymore 😅
| // Filter out enhanced sections (those whose items contain a `component` prop) | ||
| const baseSections = useMemo(() => { | ||
| const secs = Array.isArray(sections) ? sections : []; | ||
| return (secs as Array<SectionListDataType<TItem> | {data?: unknown[]}>).filter((section): section is SectionListDataType<TItem> => { |
There was a problem hiding this comment.
Reverted the changes as I went with using listFooterContent (thanks for that), so this type mess is not needed anymore 😅
| const enhancedSections = useMemo( | ||
| () => [ | ||
| ...sections, | ||
| { | ||
| data: [ | ||
| { | ||
| key: CONST.ENHANCED_SECTIONS.SPLIT_EXPENSE_ACTIONS, | ||
| component: ActionButtons, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| [sections, ActionButtons], |
There was a problem hiding this comment.
We don't need these. Can we just use listFooterContent prop on SelectionList
There was a problem hiding this comment.
Yes, that's a way better option 👍 💯
|
Looking pretty good to me too! @dubielzyk-expensify Do we want the option rows to be 8px away from the expenses like they are currently? Or should they be 20px away? I don't hate how it is now honestly. Is there a reason why when you go into Also, it looks like we have some extra padding above the |
@dubielzyk-expensify removed that as it was leftover from previously having the buttons up there
@dannymcclain I kept that space as it is between the expenses (4px coming from the top expense bottom / 4px from the top of the Add split / Make splits even buttons container) - but if we want to increase the space, it can be arranged.
Yes, this was done on purpose as the issue's OP instructed in the
☝️ It will be probably added eventually, we just skipped it here in the first PR.
That was always there (can check current production), but I removed it now, here's how things look with all changes applied: Screen.Recording.2025-10-29.at.13.33.26.mov@Expensify/design Are we good with how this looks - any other changes / adjustments required ? By the way, at the bottom of the
|
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
@parasharrajat 🟢 Logic updated, now the remainder is always on the last split which will always be the largest. Just note that in the case of $1.01 which when pressed Split, initial split is 51¢ / 50¢, now when pressed 435yyrtghgmht.movRemoved the additional tests for uneven splits ✅ |
There was a problem hiding this comment.
Reviewer Checklist
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issuessection above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Testssection - I verified the steps for Staging and/or Production testing are in the
QA stepssection - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified tests pass on all platforms & I tested again on:
- Android: Native
- Android: mWeb Chrome
- iOS: Native
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- MacOS: Desktop
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReportand notonIconClick). - I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g.
myBool && <MyComponent />. - I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text shown in the product is localized by adding it to
src/languages/*files and using the translation method - I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
- I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the
Waiting for Copylabel for a copy review on the original GH to get the correct copy. - I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- I verified the JSDocs style guidelines (in
STYLE.md) were followed
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarhave been tested & I retested again) - I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately and each prop has a
/** comment above it */ - The file is named correctly
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- For Class Components, any internal methods passed to components event handlers are bound to
thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor) - Any internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick) - All JSX used for rendering exists in the render method
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If any new file was added I verified that:
- The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
- If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- If the PR modifies the form input styles:
- I verified that all the inputs inside a form are aligned with each other.
- I added
Designlabel so the design team can review the changes.
- If a new page is added, I verified it's using the
ScrollViewcomponent to make it scrollable when more elements are added to the page. - If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps. - I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
Screenshots
🔲 iOS / native
01.11.2025_19.12.00_REC.mp4
🔲 iOS / Safari
01.11.2025_19.14.17_REC.mp4
🔲 MacOS / Desktop
01.11.2025_19.21.15_REC.mp4
🔲 MacOS / Chrome
01.11.2025_18.55.31_REC.mp4
🔲 Android / Chrome
01.11.2025_19.22.48_REC.mp4
🔲 Android / native
01.11.2025_19.18.48_REC.mp4
🎀 👀 🎀 C+ reviewed
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #72207 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
Note: The ❌ eslint / typecheck / prettier are not directly related to this PR, they come from the |
|
🟢 Ready for review! Merged main again to resolve the☝️ failing workflows coming from main. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.2.45-0 🚀
|
Revert #73474 – "New Feature: Add Make splits even functionality"
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.2.45-6 🚀
|
|
🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.2.46-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.2.46-3 🚀
|




Explanation of Change
Add a
Make splits evenbutton into the split edit table that will set the amounts (or percentages in the Split by percentage view) to equal proportions of the original expense amount.Make splits evenwill result in two .33 splits and one .34 splitFixed Issues
$ #72207
PROPOSAL:
Tests
Even splits
$10.$2.50.Uneven splits
Case 1
$10.$3.33,$3.33,$3.34.Case 2
$1.01.$0.33,$0.33,$0.35.Case 3
$1001.$333.66,$333.66,$333.68.Editing splits
$10.Offline tests
QA Steps
Same as Tests.
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)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: HybridApp
android-hybrid.mp4
Android: mWeb Chrome
android-mweb.mp4
iOS: HybridApp
ios.mov
iOS: mWeb Safari
ios-mweb.MP4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov