Skip to content

[Due for payment 2025-07-17] [$250] Android - In per diem amount, emoji or alphabet entered is briefly shown. #63127

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: V9 1.54-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: n/a
Email or phone of affected tester (no customers): applausetester+denm@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13
App Component: Workspace Settings

Action Performed:

  1. Launch app
  2. Create Workspace - enable per diem rate - Import per diem rate
  3. Open a destination
  4. Tap amount
  5. Try to enter alphabet or emoji

Expected Result:

In per diem amount, emoji or alphabet entered musnt be briefly shown.

Actual Result:

In per diem amount, emoji or alphabet entered is briefly shown.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021929695267789985999
  • Upwork Job ID: 1929695267789985999
  • Last Price Increase: 2025-06-10
  • Automatic offers:
    • brunovjk | Reviewer | 107694937
Issue OwnerCurrent Issue Owner: @adelekennedy

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 30, 2025
  2. melvin-bot commented on May 30, 2025

    @melvin-bot

    Triggered auto assignment to @adelekennedy (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.

  3. thelullabyy commented on May 30, 2025

    @thelullabyy
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    In per diem amount, emoji or alphabet entered is briefly shown.

    What is the root cause of that problem?

    The per diem amount input has shouldAllowNegative prop

    InputComponent={AmountWithoutCurrencyForm}
    defaultValue={defaultAmount}
    label={translate('workspace.perDiem.amount')}
    accessibilityLabel={translate('workspace.perDiem.amount')}
    inputID={INPUT_IDS.AMOUNT}
    role={CONST.ROLE.PRESENTATION}
    shouldAllowNegative
    />
    </FormProvider>
    </ScreenWrapper>

    So the keyboard type is the default keyboard. This allows the user to enter the emoji or alphabet and it's removed by our handle change logic.

    keyboardType={!shouldAllowNegative ? CONST.KEYBOARD_TYPE.DECIMAL_PAD : undefined}

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

    Since this input is an amount input, we can always set the keyboard type to DECIMAL_PAD

    keyboardType={CONST.KEYBOARD_TYPE.DECIMAL_PAD} 
    

    keyboardType={!shouldAllowNegative ? CONST.KEYBOARD_TYPE.DECIMAL_PAD : undefined}

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. aadil42 commented on May 30, 2025

    @aadil42
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-06-13 08:33:09 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    In per diem amount Edit page, emoji or alphabet entered is briefly shown

    What is the root cause of that problem?

    We're passing AmountWithoutCurrencyForm component to InputWrapper
    src/pages/workspace/perDiem/EditPerDiemAmountPage

        InputComponent={AmountWithoutCurrencyForm}

    In the AmountWithoutCurrencyForm component we're handling the logic for preventing the non-digit chars

    src/components/AmountWithoutCurrencyForm

        const setNewAmount = useCallback(
            (newAmount: string) => {
    
                // Remove spaces from the newAmount value because Safari on iOS adds spaces when pasting a copied value
                // More info: https://github.com/Expensify/App/issues/16974
                const newAmountWithoutSpaces = stripSpacesFromAmount(newAmount);
                const replacedCommasAmount = replaceCommasWithPeriod(newAmountWithoutSpaces);
                const withLeadingZero = addLeadingZero(replacedCommasAmount, shouldAllowNegative);
                
                if (!validateAmount(withLeadingZero, 2, CONST.IOU.AMOUNT_MAX_LENGTH, shouldAllowNegative)) {
                    return;
                }
                onInputChange?.(withLeadingZero);
            },
            [onInputChange, shouldAllowNegative],
        );

    This is the reason why we're seeing the chars/emoji briefly before they're filtered out by our logic.

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

    We should use react-native-advanced-input-mask like we're using it in AmountWithCurrencyInput here.

    In the AmountWithoutCurrencyForm component We should add these constants.

    const positiveMask = [`[09999999]${separator}[09]`];
    const positiveAndNegativeMask = [`[09999999]${separator}[09]`, `-[09999999]${separator}[09]`];

    Also we should pass an array of masks to affinityFormat prop based on shouldAllowNegative's value.

    We should prepend -? to validationRegex prop value.
    We should append - to allowedKeys prop value.

    AmountWithoutCurrencyForm file.

          <TextInput
                value={formattedAmount}
                onChangeText={setNewAmount}
                inputID={inputID}
                name={name}
                label={label}
                defaultValue={defaultValue}
                accessibilityLabel={accessibilityLabel}
                role={role}
                ref={ref}
                keyboardType={!shouldAllowNegative ? CONST.KEYBOARD_TYPE.DECIMAL_PAD : undefined}
                type="mask"
                mask={`[09999999]${separator}[09]`}
                allowedKeys="0123456789.,-"
                validationRegex={'^-?(?!.*[.,].*[.,])\\d{0,8}(?:[.,]\\d{0,2})?$'}
                affinityFormat={shouldAllowNegative ? positiveAndNegativeMask : positiveMask}
                // On android autoCapitalize="words" is necessary when keyboardType="decimal-pad" or inputMode="decimal" to prevent input lag.
                // See https://github.com/Expensify/App/issues/51868 for more information
                autoCapitalize="words"
                // eslint-disable-next-line react/jsx-props-no-spreading
                {...rest}
            />

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. melvin-bot commented on Jun 2, 2025

    @melvin-bot

    @adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 3, 2025
  7. changed the title [-]Android - In per diem amount, emoji or alphabet entered is briefly shown.[/-] [+][$250] Android - In per diem amount, emoji or alphabet entered is briefly shown.[/+] on Jun 3, 2025
  8. melvin-bot commented on Jun 3, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 3, 2025
  10. melvin-bot commented on Jun 3, 2025

    @melvin-bot

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

  11. 87 remaining items

  12. melvin-bot commented on Jul 10, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. melvin-bot commented on Jul 10, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.78-4 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-07-17. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on Jul 10, 2025

    @melvin-bot

    @brunovjk @adelekennedy 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]

  15. brunovjk commented on Jul 14, 2025

    @brunovjk
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [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: No PR directly introduced this bug. We deprecated the 'repeated' components and updated so that a single component is used with the 'mask'.

    • [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.

    Regression Test Proposal

    Test:

    1. Launch app
    2. Create Workspace - enable per diem rate - Import per diem
    3. Open a destination
    4. Tap amount
    5. Try to enter alphabet or emoji
    6. Verify the alphabet/emoji does not appear briefly

    Do we agree 👍 or 👎

  16. melvin-bot commented on Jul 21, 2025

    @melvin-bot

    @adelekennedy Eep! 4 days overdue now. Issues have feelings too...

  17. adelekennedy commented on Jul 22, 2025

    @adelekennedy
    Contributor

    Payment Summary

    Contributor: @aadil42 owed $250 due via Upwork offer here
    Contributor+: @brunovjk paid $250 via Upwork

  18. melvin-bot commented on Jul 25, 2025

    @melvin-bot

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

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