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

[Issue-1146] Fix CardField validation problem on Android #1213

Conversation

pavelglebov
Copy link
Contributor

@pavelglebov pavelglebov commented Nov 27, 2022

Issue: #1146

Order of react props apply is not as expected:
setCountryCode applied first, then setPostalCodeEnabled. As postalCodeEnabled is true by default, it leads to issues with postalCodeEnabled={false} on react side.

Summary

Safely change mCardWidget.postalCodeRequired = false when postalCodeEnabled={false}

Motivation

For some reason, react props are applied to Android native element in unexpected order (countryCode first, then postalCodeEnabled), which in conjunction with default value of polstalCodeEnabled === true leads to non-working CardField on Android with postalCodeEnabled={false}

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

Order of react props apply is not as expected:
setCountryCode applied first, then setPostalCodeEnabled.
As postalCodeEnabled is true by default, it leads to issues
with postalCodeEnabled={false} on react side.
@CLAassistant
Copy link

CLAassistant commented Nov 27, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@charliecruzan-stripe charliecruzan-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch! thanks for the PR 👍

@charliecruzan-stripe charliecruzan-stripe merged commit 6e0178e into stripe:master Nov 28, 2022
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

Successfully merging this pull request may close these issues.

3 participants