Skip to content
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

InputNumber does not handle currency/decimals properly #32924

Closed
1 task
ClayA-M opened this issue Nov 17, 2021 · 1 comment
Closed
1 task

InputNumber does not handle currency/decimals properly #32924

ClayA-M opened this issue Nov 17, 2021 · 1 comment
Labels

Comments

@ClayA-M
Copy link

ClayA-M commented Nov 17, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

(Notice, linked code sandbox is listed as an example on official documentation)

  1. Choose USD. If there is a value, highlight the entire field by double clicking.
  2. Try to type in "10.25"
  3. Notice "$10.00.2" appears, then on blur, we are left with "10.00"
  4. There is some issue when user types 0 or tries to add decimals.

What is expected?

User should be able to type in a currency amount with decimals properly. In this case, user can't type after the decimal properly. It seems the component is re-rendering way more often than the 3.26.17 version. In the previous version, the component only re-rendered & reformatted the result after the user blurred the input. Now, the component is updating the value with every keystroke, making it very difficult to handle decimals -- even for the given example application. It should instead only re-format after the user blurs.

What is actually happening?

There is some issue when user types 0. The elements re-renders too often; It should really only update the decimal after the user blurs.

Environment Info
antd 4.17.0
React ^16.13.1, latest
System Mac/Windows, *
Browser Chrome, *

After updating from ^3.26.17, we found our Input formatter no longer functioned properly for prices. I came here to see documentation on the update, and found even the antd example contains the same problem.

@jimmyn
Copy link

jimmyn commented Dec 23, 2021

I'm facing a similar problem

afc163 added a commit that referenced this issue Jun 16, 2023
afc163 added a commit that referenced this issue Jun 16, 2023
afc163 added a commit that referenced this issue Jun 16, 2023
* style: Fix InputNumber prefix style in Form.Item

close #32924

* Update components/input/style/mixin.less

* chore: update demo

* revert style

* chore: update demo
@afc163 afc163 closed this as completed in 446e833 Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants