-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[$500] [POLISH][Search v2.1] Amount filter - Native - The digit exceeding the max allowed decimal places is briefly inserted into the input #47875
Comments
Triggered auto assignment to @isabelastisser ( |
Job added to Upwork: https://www.upwork.com/jobs/~017b65a6e5c7b77ba2 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk ( |
Validation Function: Create a function to check if the input exceeds the allowed decimal places. |
📣 @eyobai! 📣
|
ProposalPlease re-state the problem that we are trying to solve in this issue.The digit exceeding the max allowed decimal places is briefly inserted into the input What is the root cause of that problem?This issue occurs because we use onChangeText to validate the amount between lines 37 and line 40. If the amount is not valid, we return and remove the text change in the text input App/src/components/AmountWithoutCurrencyForm.tsx Lines 29 to 43 in 0c84552
What changes do you think we should make in order to solve the problem?We should check that the decimal limit has been reached and no more decimals can be entered before the text changes. // src/components/AmountWithoutCurrencyForm.tsx#L17
+ const decimals = 2;
// src/components/AmountWithoutCurrencyForm.tsx#L37
- if (!validateAmount(withLeadingZero, 2)) {
+ if (!validateAmount(withLeadingZero, decimals)) {
// src/components/AmountWithoutCurrencyForm.tsx#L45
+ const getDecimalLength = (numStr: string) => {
+ const parts = numStr.split('.');
+ return parts[1] ? parts[1].length : 0;
+ };
// src/components/AmountWithoutCurrencyForm.tsx#L46
return (
<TextInput
value={formattedAmount}
onChangeText={setNewAmount}
inputID={inputID}
name={name}
label={label}
defaultValue={defaultValue}
accessibilityLabel={accessibilityLabel}
role={role}
ref={ref}
keyboardType={CONST.KEYBOARD_TYPE.DECIMAL_PAD}
+ maxLength={getDecimalLength(formattedAmount) === decimals ? formattedAmount.length : undefined}
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
/>
); POC
Screen.Recording.2024-08-25.at.01.13.48.mov |
Thank you for the proposal @huult, but I tested it and it doesn't seem to resolve the issue. The RCA focuses on |
@brunovjk , Thanks for reviewing my proposal. I double-checked and found that it works when the user types from the keyboard but does not work when pasting a number into the input field or entering multiple decimal points. I am investigating further. |
This most likely is related to a known issue for the |
@luacmartins, @isabelastisser, @brunovjk Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Thank you, @AlfredoAlc, for the reference. It aligns with our issue, but I haven’t found a fix yet, only workarounds. |
@brunovjk , test branch for my proposal POC
Screen.Recording.2024-08-29.at.09.27.32.mp4 |
Thank you @huult :D I just tested. Almost there, but the problem is not just in the decimals: Screen.Recording.2024-08-29.at.10.36.14.movIf the video above is no longer available when you watch it, let me know. |
@brunovjk , I've updated the test branch to fix the issue you tested. Screen.Recording.2024-08-29.at.21.24.51.mp4 |
Thank you for your efforts, @huult. Unfortunately, the solution still isn’t working as expected on my end. As we can't attack the root cause directly, we might need a "workaround" to address this effectively. I’m confident we can find one that won’t introduce regressions. Let’s keep exploring options—I’ll revisit this next week, and we can involve an internal engineer if necessary. Screen.Recording.2024-08-29.at.16.57.22.mov |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@luacmartins, @isabelastisser, @brunovjk Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
I can still reproduce this issue: Screen.Recording.2024-12-02.at.09.39.46.movLooking for proposals/solutions. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Same as above |
@brunovjk I created a PoC here: #53695 Feel free to play with that changes and if you have any questions I'll be happy to answer them 😊 It's worth to note, that I didn't integrate a new type of input (masked input) into existing codebase. I simply showed how masked input can work - so styling of input is broken and most likely form submitting mechanism is broken as well, it's just a PoC to show, that masked input will not allow you to enter more symbols if mask template has been filled properly. If we decided to go with this approach (and I really hope we will do that) then I'll properly integrate the new input into existing codebase so that we can use it preserving all styles and all generic components that we already use 🤞 |
Great @kirillzyusko! I'll review it calmly on Monday 🤞 and let you know, but in any case we eventually need a proposal, following the template, to present to the internal team, only they, after a proposal is approved, can assign you for the task. But I'm already very grateful for your effort. |
Thanks, appreciate your help here! Then, please, test, and if everything is alright I'll prepare a proposal following template 👀 |
Testing today |
Thanks for providing the POC, @kirillzyusko. I tested the implementation, but unfortunately, it doesn't seem to work as expected on my side. I don’t think I missed anything, but there’s a chance something went wrong during my setup. Could you share how your testing went? Thank you! Screen.Recording.2024-12-09.at.17.54.41.mov |
@brunovjk try to set a dark theme and you will see the white input below (in the light theme the white input is barely visible). You are testing old implementation. On this page I re-worked only one input (the second one) and kept first one to take it as a reference in terms of functionality/formatting rules. Would you mind to do testing again? I'll share a video tomorrow 🙃 |
Thanks for clarifying, testing in a moment |
Very good! It seems promising to me: test PocScreen.Recording.2024-12-11.at.09.11.39.movI can still reproduce some bugs:
@kirillzyusko do you believe these bugs were expected and we will fix them later? I'm here if you need anything. Again, thank you very much for your effort. |
Well, I believe I can fix some of them straight away (such as My main concern is that we would need to add a new library... Does it make sense to open an issue about adding a new library and see whether Expensify team is happy to have it in |
Great question @kirillzyusko, I'm going to ask you a favor, write a proposal with all the information you think is important, along with these questions, we will forward it to an internal member of the Expensify team, they knew exactly what to do next. How does it sound? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
ProposalPlease re-state the problem that we are trying to solve in this issue.The digit exceeding the max allowed decimal places is briefly typed into the input What is the root cause of that problem?The problem in current implementation is that the communication between JS/Native thread is asynchronous. So when we type a value we immediately apply update on a native thread and show a newly typed digit. But formatting happens on JS, thus we always have a delay of 16ms and we can observer how digits are flickering. What changes do you think we should make in order to solve the problem?We should use a solution, where formatting happens synchronously on a native thread. In Note The functionality with formatting dates/phone numbers/currency/card numbers and other inputs is a common task for native developers too. The What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?It can be hard to automate this thing, just because only humans can notice the flickering. What alternative solutions did you explore? (Optional)
As an alternative we can use a fork called react-native-advanced-input-mask. Advantages of this fork:
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. @brunovjk please, review this proposal and in case if anything is missing - let me know 😊 |
I asked on Slack and luacmartins will look into it when they have a moment. |
@brunovjk please, keep me updated here as well 🙌 It looks like I don't have an access to this channel/conversation 😔 |
Of course, we are still waiting for @luacmartins's thoughts. |
So it seems like the suggestion is to go with the alternate solution, given the main library is abandoned and doesn't support fabric. I'll raise the library request in Slack and we'll see what the team decides |
Created an issue for the lib request here and started a discussion in Slack |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
FYI, I will be OOO from Dec 23 to Jan 6, so please reassign the issue to another team member for urgency, IF needed. |
This is a follow-up issue.
Coming from: #47343 (comment) and #47343 (comment)
Bug in iOS and Android native apps: When entering a number, the digit exceeding the maximum allowed decimal places is briefly inserted into the input field before being deleted. They should not be inserted at all.
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-08-15.at.15.52.28.mp4
cc @luacmartins @289Adam289
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @Issue Owner
Current Issue Owner: @brunovjkThe text was updated successfully, but these errors were encountered: