stripe-react-native: [Bug] [Android] CardField onCardChange not triggering in React Native Stripe

Describe the bug The CardField component’s onCardChange callback is not triggering when entering card details. No values are being received in the callback function, making it impossible to capture and validate card information.

To Reproduce Steps to reproduce the behavior:

  1. Initialize Stripe in your React Native app
  2. Implement CardField component with onCardChange handler
  3. Run the app and navigate to the credit card input screen
  4. Try entering card details in the field
  5. Check console logs - no output is shown
  6. Check card state - remains null

Code example:

<CardField
postalCodeEnabled={false}
placeholders={{
number: '1234 1234 1234 1234',
}}
cardStyle={{
backgroundColor: '#FFFFFF',
textColor: '#000000',
}}
style={{
height: 50,
width: '100%',
}}
onCardChange={(cardDetails) => {
console.log('Card Details:', cardDetails);
setCard(cardDetails.complete ? cardDetails : null);
}}
/>

Screenshot

Image

Expected behavior

  • onCardChange callback should fire whenever user enters or modifies card details
  • Callback should receive CardFieldInput.Details object containing card information
  • Console should show logged card details
  • Card state should update when details are complete

Smartphone (please complete the following information):

Additional context

  • Component renders correctly and is visible
  • No error messages in console
  • Other Stripe components working as expected
  • Stripe initialization is successful
  • Issue occurs on Android only

Possible Workarounds Needed Looking for either:

  1. Correct implementation of CardField with working onCardChange
  2. Alternative method to capture card details
  3. Any known workarounds for this issue

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Hi all, thank you all for your patience. I’m sorry it’s taken us way too long to support the new architecture. We have begun our work to start migrating to the new architecture over the past couple of weeks and hope to complete it over the next 4-6 weeks. If anything changes, you can expect to see an update, but I’m optimistic we should be able to complete it by then.

This particular issue should be fixed in the latest version 0.40.0.

I apologize again for the delay. Please keep the feedback coming as well; we will do a better job at communicating with you all in GitHub issues going forward. I will close this issue for now, but please re-open if you continue to experience this issue after updating to the latest version.

Here is a patch that works with fabric enabled app on Android:

@stripe-stripe-react-native-npm-0.41.0-7a76d4dacd.patch

It also includes the patch for https://github.com/stripe/stripe-react-native/issues/1732 with slight modifications. Here is the reference: https://github.com/stripe/stripe-react-native/issues/1732#issuecomment-2594110710

Same, is anyone trying to implement payment element instead?