You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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)
The text was updated successfully, but these errors were encountered:
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
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.
PhoneNumberInput
Overview / Summary
Summary description of UI component
The
PhoneNumberInput
component was added with the AddressForm and currently is just a simple copy of theTextInput
that removes special characters from the input value on change.The
PhoneNumberInput
could use 2 modification: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 theForm
component on submit.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)
The text was updated successfully, but these errors were encountered: