Skip to content

Fix split expense text input not editable when the expense amount is negative - #77966

Closed
tsa321 wants to merge 30 commits into
Expensify:mainfrom
tsa321:fixSplitAmountEdit
Closed

tsa321 wants to merge 30 commits into
Expensify:mainfrom
tsa321:fixSplitAmountEdit

Conversation

@tsa321

@tsa321 tsa321 commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #76668
PROPOSAL: #76668 (comment)

Tests

  1. Go to the WS room and create an expense with a negative amount
  2. Go to the expense details report
  3. Split the expense by clicking More → Split → Save
  4. Select one of the split expenses
  5. Click the Amount field
  6. Try to edit the split amount
  7. Verify there is minus - sign beside the text input and amount edit is possible
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  1. Go to the WS room and create an expense with a negative amount
  2. Go to the expense details report
  3. Split the expense by clicking More → Split → Save
  4. Select one of the split expenses
  5. Click the Amount field
  6. Try to edit the split amount
  7. Verify there is minus - sign beside the text input and amount edit is possible
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (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. toggleReport and not onIconClick)
    • 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
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • 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 either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • 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
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • 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.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
android_native_d.mp4
Android: mWeb Chrome
android_mweb_d.mp4
iOS: Native
ios_native_d.mp4
iOS: mWeb Safari
ios_msafari_d.mp4
MacOS: Chrome / Safari
macos_web_d.mp4

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321
tsa321 requested review from a team as code owners December 18, 2025 07:45
@melvin-bot

melvin-bot Bot commented Dec 18, 2025

Copy link
Copy Markdown

@abdulrahuman5196 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]

@melvin-bot
melvin-bot Bot requested review from joekaufmanexpensify and removed request for a team December 18, 2025 07:45
@melvin-bot

melvin-bot Bot commented Dec 18, 2025

Copy link
Copy Markdown

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@melvin-bot
melvin-bot Bot removed the request for review from a team December 18, 2025 07:45
Comment thread src/components/SelectionListWithSections/SplitListItem.tsx Outdated
Comment thread src/components/SelectionListWithSections/SplitListItem.tsx Outdated
Comment thread src/components/SelectionListWithSections/SplitListItem.tsx Outdated
Comment thread src/components/SelectionListWithSections/SplitListItem.tsx Outdated
Comment thread src/components/NumberWithSymbolForm.tsx Outdated
Comment thread src/components/AmountTextInput.tsx Outdated
Comment thread src/components/TextInputWithSymbol/BaseTextInputWithSymbol.tsx Outdated
Comment thread src/components/NumberWithSymbolForm.tsx Outdated
@codecov

codecov Bot commented Dec 18, 2025

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/pages/iou/SplitExpensePage.tsx 0.00% <0.00%> (ø)
... and 83 files with indirect coverage changes

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321
tsa321 marked this pull request as draft December 18, 2025 07:57
@tsa321

tsa321 commented Dec 18, 2025

Copy link
Copy Markdown
Contributor Author

@abdulrahuman5196 I need to modify some base elements because we need to display the flip +/- button on mobile, especially iOS. These changes to the base elements are needed to properly align the negative sign button and the flip button on mobile devices. I think this PR can be simplified without touching the base elements. I’m waiting for the expected behavior and will simplify the code afterward.

  1. In this PR, I focus on text input editing behavior, so I am not touching any validation logic on the SplitExpensePage.
  2. There is a bug on main in iOS where only the text inside the text input is wrapped onto a new line:
Number is warped to a new line: Screenshot 2025-12-18 at 14 49 11

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321 tsa321 changed the title Fix text input of split expense Fix split expense text input not editable when the expense amount is negative Dec 18, 2025
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@abdulrahuman5196

Copy link
Copy Markdown
Contributor

checking now

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321

tsa321 commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

@abdulrahuman5196 I have updated the code

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

@tsa321 The code looks good. Could you kindly fix the merge conflicts? I can work on platforms checking.

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321

tsa321 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

@abdulrahuman5196 In PR #79273, this comment #79273 (comment) adds the allowNegative property to SplitAmountInput, which allows the split amount to be edited as either negative or positive.

As a result, the split amounts are now freely editable to positive or negative values without considering whether the original amount is positive or negative. This behavior differs from the expected solution described here:
#77966 (comment)

What should we do here?

Also, adding allowNegative directly to the base elements in MoneyRequestAmountInput.tsx and NumberWithSymbolForm.tsx will cause an issue on iOS, because the iOS keyboard doesn’t include a negative (-) sign. That’s why, on mobile, there is a +/- toggle button for the amount input.

What is best here?

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

@tsa321 I am not able to fully understand your concern. from what i understand,

I think you are saying that in the https://github.com/Expensify/App/pull/79273/changes they have created changes to allow editing split with positive and negative values.
Currently in this PR we have added - as a text, but in the other PR they have added the allowNegative which allows directly editing in the input field.

IMO, we should focus on the issue OP we have which is to fix the delete issue where we are unable to delete the split numbers. We should not change any split editing logic since it was explicitly add here https://github.com/Expensify/App/pull/79273/changes.

Let me know if there are some other queries? @tsa321

@tsa321

tsa321 commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

IMO, we should focus on the issue OP we have which is to fix the delete issue where we are unable to delete the split numbers. We should not change any split editing logic since it was explicitly add here https://github.com/Expensify/App/pull/79273/changes.

@abdulrahuman5196 Based on your comment, we are preserving the allowNegative change from the other PR. Since that PR (by adding allowNegative )also fixes the OP issue, I will revert my changes related to the - text sign.

Since that PR was reverted due to some issues, I’m currently waiting for the follow-up PR to be merged.
This is correct step right?

@abdulrahuman5196

abdulrahuman5196 commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

@ikevin127 Since you are the PR owner of changing the split logic here - #77966 (comment)

Could you kindly provide insights on this #77966 (comment) , #77966 (comment) so that we don't cause conflicts in both PRs.

@ikevin127

Copy link
Copy Markdown
Contributor

Feel free to proceed with the fix required to resolve your issue here, I'll proceed with mine and if there are any conflicts I'll make sure to resolve them if your PR merges first.

Also, adding allowNegative directly to the base elements in MoneyRequestAmountInput.tsx and NumberWithSymbolForm.tsx will cause an issue on iOS, because the iOS keyboard doesn’t include a negative (-) sign. That’s why, on mobile, there is a +/- toggle button for the amount input.

☝️ Regarding this issue, in a recent merge with main I noticed that the keyboard type was removed which I assume was the reason for the iOS number keyboard lock problem.

That keyboard issue wasn't reported when we merged the other PR first time (which was reverted for a rework), and if it will in the future we can resolve it as it's not a blocker.

@tsa321

tsa321 commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

@ikevin127 what I mean is that on iOS (both mobile web and native), the numeric-only keyboard does not provide a - (minus) key:

screen_shootA

So when the minus sign is deleted, there is no way to add it back.


On the step amount page, there is a `+/-` toggle button provided to add or remove the minus sign: expense_

@ikevin127

Copy link
Copy Markdown
Contributor

Understood, feel free to proceed with a fix for your PR that will cover the whole issue - even if it might conflict with my PR, since yours will also target the Native issue which is a plus 👍

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321

tsa321 commented Feb 23, 2026

Copy link
Copy Markdown
Contributor Author

@abdulrahuman5196 The issue where negative amounts could not be edited has been resolved by another PR. However, on iOS, we still cannot enter a negative amount because the iOS numeric keyboard does not include a negative (-) key, as described here.

Should we add a +/- flip button for iOS only (native and mobile)?

This could look something like the following:

Flip button on the left:

Flip button on the left

Flip button at the bottom:

Flip button at the bottom

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

@tsa321 I don't think we should do this - #77966 (comment). This would be a totally different issue, not part of this one.

If the original issue for this PR is fixed, Could you kindly provide video sample of issue fix? I will do the same from my end and we should be good to close this.

@tsa321

tsa321 commented Feb 23, 2026

Copy link
Copy Markdown
Contributor Author

@abdulrahuman5196

In production, we are able to edit the negative split amount, so the issue has been resolved:

test_d.mp4

Should I close this PR now?

@tsa321

tsa321 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

cc @abdulrahuman5196, I can close this PR now, right?

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

cc @abdulrahuman5196, I can close this PR now, right?

Yes. we should close this PR

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

@tsa321

@tsa321 tsa321 closed this Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants