-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Ability to unmask currency as a float #34
Comments
Yeah that cannot be the expected behavior at all. Periods should definitely be part of the raw text. |
@DinsmoreDesign will you be implementing this enhancement? I too would like to see this altered |
Unfortunately, I'm no longer working on React Native projects. I'm surprised this hasn't been fixed yet, it's been almost 2 years since I posted the issue. I'd suggest using a different library altogether if the package isn't being maintained, or you're welcome to steal my solution if you have to use it. |
the library is open source, you can create a PR whenever you want! |
we also support Issuehunt to budget desired issues from the community, or my GitHub sponsors to get special features requests or reviews/test |
Ouch. Was just asking a question |
Describe the Feature
Currently, if you type in a value using currency masking, ie:
And type in the input something like "$4,732.55" then try to unmask it through the onChange event:
You get the completely unmasked string, which isn't what I'd think most people would expect. I expect the string returned to be
4732.55
, but it looks like the library removes all the separators and prefixes. Right now, I have a function that checks if the length of the value is greater than whatever the precision is and if it is, return the value with the decimal at-${precision}
, instead, but I don't really know if returning an unmasked value without the precision included is helpful to anyone and it should probably just be built into the library.Possible Implementation
Right now I'm taking the unmasked value and running this function on it:
Which seems to return everything how I'd expect. I assume the library is probably doing the masking with some sort of Regex pattern though, which would be a lot more simple to implement in reverse.
The text was updated successfully, but these errors were encountered: