-
Notifications
You must be signed in to change notification settings - Fork 658
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
Remove filter on postal codes when switching away from US #4385
Conversation
@skyler-stripe We recently removed the CA postal code validation, and instead let any characters be entered as is the case for global configs. Can we just keep the validation more open for Canada, so they can center any character, number, dashes, etc, similar to other countries? |
I would rather lean away from doing any postal code verification except for US. This matches iOS. We had recently removed the postal code validation for Canada for other issues that had come up. I think the only change needed as a result of the user reported issue is in the PostalCodeEditText:
in order to remove the length restriction. |
Yeah it turns out when we we starting with US, the filter of 5 characters was being applied but not removed when switching to global. I removed the regex stuff and the filter and it works as expected. |
I didn't realize we had validation for other countries but removed it. I updated the PR with your suggestion below. |
Diffuse output:
APK
DEX
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, thanks!
Summary
This adds support for Canada style postal codes in PostalCodeEditText. Canadian postal codes are slightly different from US zip codes and it was previously impossible to input one. The rules for the regex are as follows:
I read online that it's better to allow users to input a dash instead of a space, or omit the space rather than enforcing it. So I did slightly break the rules.
EDIT: Michelle pointed out that this way of doing things has caused problems. I discovered the real source of the problem was that we were adding a filter of 5 characters when starting with US but not removing it when switching to other countries. Making the filter an empty list on global countries fixes this issue.
Motivation
https://jira.corp.stripe.com/browse/RUN_MOBILESDK-530
I think we should eventually add support for all country postal codes via regex, but I think this temporary band aid will get our merchant working.
Testing
Screenshots