Pass userTyping to custom formatter of InputNumber
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
Since the recent rewrite of InputNumber
, which basically ignores the precision
prop when there is a custom formatter
, it is important to allow such custom formatter
to fully replicate the precision
logic. This requires that userTyping
is passed down to said custom formatter
. Whilst migrating to a new version of ant-design, one of my tests is breaking due to this change, and I cannot see any easy solution around it (apart from this feature request).
Reproduction: codesandbox
The reproduction very simply tries to imitate the precision
prop functionality with a custom formatter
. The moment a user types a value, the input automatically adds the precision and moves the cursor, making the input unusable. The custom formatter
would need userTyping
to prevent that from happening (+ some other situations).
What does the proposed API look like?
Pass userTyping
to any custom formatter
of the InputNumber
component.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (8 by maintainers)
Top GitHub Comments
I like
formatter(text: string, info: { userTyping: boolean })
.1