Skip to content

Preventing brief occurrences of emojis and non-digit chars.#64689

Closed
aadil42 wants to merge 6 commits into
Expensify:mainfrom
aadil42:issues/63127/emoji-alphabet-brifely-shown-in-per-diem-field
Closed

Preventing brief occurrences of emojis and non-digit chars.#64689
aadil42 wants to merge 6 commits into
Expensify:mainfrom
aadil42:issues/63127/emoji-alphabet-brifely-shown-in-per-diem-field

Conversation

@aadil42
Copy link
Copy Markdown
Contributor

@aadil42 aadil42 commented Jun 21, 2025

Explanation of Change

Using react-native-advanced-input-mask to prevent brief occurrences of emojis and non-digits chars.

Not passing value prop to <TextInput> anymore to prevent flickering issue. See this Comment Proposal for more details.

Fixed Issues

$ #63127
PROPOSAL: #63127(comment)

Tests

  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
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • 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
    • MacOS: Desktop
  • 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 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-test.mp4
Android: mWeb Chrome
android.mweb.test.mp4
iOS: Native
ios.native.test.mp4
iOS: mWeb Safari
ios.mweb.test.mp4
MacOS: Chrome / Safari
web.chrome.mp4
MacOS: Desktop
mac.os.desktop.mp4

@aadil42 aadil42 requested a review from a team as a code owner June 21, 2025 00:14
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented Jun 21, 2025

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 requested review from brunovjk and removed request for a team June 21, 2025 00:14
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented Jun 21, 2025

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 21, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 21, 2025

I have read the CLA Document and I hereby sign the CLA

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 24, 2025

@brunovjk, So just to be clear. We're gonna use inputAmountWithoutCurrencyInput now. What about the logic that allows us negative values? Do we want to have that logic in AmountWithoutCurrencyInput as well? right now if we allow negative values it has no effect with AmountWithoutCurrencyInput Checkout these changes

Avoid passing value for `uncontrolled` prop
CLABotify added a commit to Expensify/CLA that referenced this pull request Jun 24, 2025
aadil42 added 2 commits June 24, 2025 22:18
Using `AmountWithoutCurrencyInput` component.
@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 24, 2025

@brunovjk, We're almost done. Just waiting for your advice on this comment

We're now using AmountWithoutCurrencyInput

Changes ofAmountWithoutCurrencyForm are reverted back.

Now, we just need to update AmountWithoutCurrencyInput component for accepting negative values as well. currently we're not able to have negative values even if we pass shouldAllowNegative prop to be true.

@brunovjk
Copy link
Copy Markdown
Contributor

Let's confirm before moving forward hehehhe Asked here

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 25, 2025

@brunovjk, I don't have access.

image

I've been asking for the access from the past 2 months. But They always say there's some problem going on.

image

Can you let me in please? Thank you.

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 25, 2025

I'm am really sorry for the delay @brunovjk. And thank you for the opportunity. I was up untill 1 AM then I went to sleep so I couldn't reply yesterday.

@brunovjk
Copy link
Copy Markdown
Contributor

@brunovjk, I don't have access.

Sorry about that and the delay.

@brunovjk
Copy link
Copy Markdown
Contributor

@iwiznia confirmed "Yes, it should accept negative values"

@brunovjk
Copy link
Copy Markdown
Contributor

Do we have everything we need to move forward?

@brunovjk
Copy link
Copy Markdown
Contributor

Can you let me in please? Thank you.

I dont have permission to do it :/

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 25, 2025

Everything is done. Just need to test it. Build is giving error. I'll get back to you after testing.

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 25, 2025

Can you let me in please? Thank you.

I dont have permission to do it :/

Yeah. I don't know when it will be resolved. I've been trying for the past 2 months.

@brunovjk
Copy link
Copy Markdown
Contributor

Everything is done. Just need to test it. Build is giving error. I'll get back to you after testing.

Great!

@brunovjk
Copy link
Copy Markdown
Contributor

Can you let me in please? Thank you.

I dont have permission to do it :/

Yeah. I don't know when it will be resolved. I've been trying for the past 2 months.

That's weird, I'll message someone about it.

Add logic that allows negative values.
@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 25, 2025

@brunovjk, I added the logic that allows negative values in AmountWithoutCurrencInput I tested it on all the platforms locally with the latest changes and it works perfect 👌. We can move forward.

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 25, 2025

Hey @brunovjk just drawing your attention here.

@brunovjk
Copy link
Copy Markdown
Contributor

@brunovjk, I added the logic that allows negative values in AmountWithoutCurrencInput I tested it on all the platforms locally with the latest changes and it works perfect 👌. We can move forward.

Great, very good, now I'm away from the keyboard, I'll test it tomorrow morning. Can we safely remove component AmountWithoutCurrencyForm? Since it won't be used anymore.

@iwiznia
Copy link
Copy Markdown
Contributor

iwiznia commented Jun 26, 2025

Can we safely remove component AmountWithoutCurrencyForm? Since it won't be used anymore.

Yeah, we should

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 26, 2025

Ok. I'll delete AmountWithoutCurrencyForm file.

Also, I noticed something.

Should we also change the displayName of AmountWithoutAmountWithoutCurrencyInput to AmountWithoutAmountWithoutCurrencyInput

image

Delete AmountWithoutCurrencyForm because it is not used.
@aadil42 aadil42 changed the title preventing brief occurrences of emojis and non-digit chars. Preventing brief occurrences of emojis and non-digit chars. Jun 26, 2025
@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 26, 2025

@brunovjk, In this PR I had an unverified commit that was committed locally. A lot of force-pushing and rebasing was involved in making that commit verified. Instead I created a new PR And commits are verified now. Sorry for that.

@brunovjk
Copy link
Copy Markdown
Contributor

Also, I noticed something.

Should we also change the displayName of AmountWithoutAmountWithoutCurrencyInput to AmountWithoutAmountWithoutCurrencyInput

Yes, Nice!!!

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 26, 2025

Great. @brunovjk, All the changes are in place. It works on all platform you can review the new PR

@brunovjk
Copy link
Copy Markdown
Contributor

Sure :D

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 26, 2025

@brunovjk How stupid of me. I found the issue. The reason it was working in the other PR is because we were passing uncontrolled prop to be true in EditPerDiemAmountPage.

image

I removed that part because github action was yelling at me for passing a boolean value as shown in the image above. So I removed it. But yes it is because of this that we don't have default values anymore because it becomes undefined when we don't pass uncontrolled as true when the input component is uncontrolled which is correct for our changes. We did make it uncontrolled.

This code is what is making defaultValue prop to be undefined and we also don't have the value prop in our input anymore so we see empty input.

// As the text input is controlled, we never set the defaultValue prop
// as this is already happening by the value prop.
// If it's uncontrolled, then we set the `defaultValue` prop to actual value
defaultValue: inputProps.uncontrolled ? inputProps.defaultValue : undefined,

@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jun 26, 2025

Default value for uncontrolled prop is false. How do we make it true without passing true value? Do we create a constant or something?

@brunovjk
Copy link
Copy Markdown
Contributor

I dont think we need this PR, right @aadil42? I think we can close. I will check now the other one. Thanks.

@aadil42 aadil42 closed this Jul 1, 2025
@aadil42 aadil42 reopened this Jul 1, 2025
@aadil42
Copy link
Copy Markdown
Contributor Author

aadil42 commented Jul 1, 2025

@brunovjk, yes we can close this one.

Closing this PR because of unverified commits. Check this PR now.

@aadil42 aadil42 closed this Jul 1, 2025
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.

3 participants