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

isCharacterSame is not called on NumericFormat #850

Closed
1 task done
raDiesle opened this issue Aug 5, 2024 · 2 comments
Closed
1 task done

isCharacterSame is not called on NumericFormat #850

raDiesle opened this issue Aug 5, 2024 · 2 comments

Comments

@raDiesle
Copy link

raDiesle commented Aug 5, 2024

Describe the issue and the actual behavior

isCharacterSame is not called on NumericFormat (v5.4.0) ,
but TypeScript types tell me the prop exists

Describe the expected behavior

NumericFormat allows me to specifiy isCharacterSame, but its not called.
When defined on NumberFormatBase, it is called

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/s/alloweddecimalseparators-demo-forked-4z33vm?file=/src/App.js

Provide steps to reproduce this issue

The use case:
The form stores type of number, but react-number-format stores in string.
When I enter "." on decimalScale , the cursor jumps to the beginnig, because ".00" is not the same as "0"
So I want the cursor to start right next to the "." as its working in the demos

Please check the browsers where the issue is seen

  • Chrome
@s-yadav
Copy link
Owner

s-yadav commented Aug 25, 2024

This is expected, isCharacterSame is prop for NumberFormatBase and internally used in NumericFormat to handle certain cases.

In case you want to override you can use useNumericFormat hook with NumberFormatBase, and then can pass monkeyPatch isCharacterSame coming from useNumericFormat.

Looks like it's leaked on types of NumericFormat. Will fix that.

s-yadav added a commit that referenced this issue Aug 25, 2024
…Format as its a number_format base props and shouldn't be used outside. #850
@s-yadav
Copy link
Owner

s-yadav commented Aug 25, 2024

Removed type from NumericFormat and PatternFormat on 5.4.1

@s-yadav s-yadav closed this as completed Aug 25, 2024
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

No branches or pull requests

2 participants