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

PhoneNumberInput needs masking prop #171

Open
nnnnat opened this issue Jul 31, 2018 · 1 comment
Open

PhoneNumberInput needs masking prop #171

nnnnat opened this issue Jul 31, 2018 · 1 comment
Labels
enhancement For issues that describe a feature that needs to be added, changed, or removed, but is not a bug

Comments

@nnnnat
Copy link
Contributor

nnnnat commented Jul 31, 2018

PhoneNumberInput

Overview / Summary

Summary description of UI component

The PhoneNumberInput component was added with the AddressForm and currently is just a simple copy of the TextInput that removes special characters from the input value on change.

The PhoneNumberInput could use 2 modification:

  1. Update component code to just be a wrapper if the TextInput component instead of a copy. This was my original approach but I was unable to get the wrapped input to return a value to the Form component on submit.
  2. The PhoneNumberInput needs to accept a prop that set the inputs formatting pattern. Not totally sure how to best do it but I was thinking you could pass a regX as a prop. @reactioncommerce/ design would like to use (XXX) XXX-XXXX as the default value format.
    - One caveat is we need the input to display the value with the provided phone number format we always need to return a phone number that has been stripped of all special characters (i.e. 5042347878)
@nnnnat nnnnat added the enhancement For issues that describe a feature that needs to be added, changed, or removed, but is not a bug label Jul 31, 2018
@nnnnat nnnnat added this to the Jupiter milestone Jul 31, 2018
@spencern spencern modified the milestones: Jupiter, Kit Carson Aug 7, 2018
@aldeed
Copy link
Contributor

aldeed commented Jan 18, 2019

The best solution I've found for this is https://text-mask.github.io/text-mask/. We should be able to just swap the input for that, and supply the mask. The hard part would be figuring out the mask for each country.

Alternatively, there is https://www.npmjs.com/package/react-phone-number-input, which already has the country selection. If it's not too hard to style that to match and tweak it to work with ReactoForm, it has more out-of-the-box features.

@machikoyasuda machikoyasuda removed this from the Kit Carson milestone Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For issues that describe a feature that needs to be added, changed, or removed, but is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants