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

onFormComplete is not working for CardForm in Android #1804

Open
haris18896 opened this issue Jan 2, 2025 · 1 comment
Open

onFormComplete is not working for CardForm in Android #1804

haris18896 opened this issue Jan 2, 2025 · 1 comment

Comments

@haris18896
Copy link

haris18896 commented Jan 2, 2025

Describe the bug
Not sure if its a bug, but the onFormComplete is not getting triggered on Android, though its working fine on IOS

To Reproduce
Steps to reproduce the behavior:

  1. Console log the cardDetails in onFormComplete
  2. check the logs in the terminal for ios it will be returning the card details for Android its not even getting triggered

Expected behavior
when card number, expiration date, CVC and postal code have been added, it should trigger the onFormComplete, which is working fine for IOS but not for Android

Screenshots
here is the IOS Screenshot, in which you can see the button has been activated because we are getting the card details
simulator_screenshot_EE5A7E55-894F-4338-8FAE-4B77AABD3CFE

here
Screenshot_1735803041
is the screenshot for Android

Smartphone (please complete the following information):

  • Device: Android vivo v25e
  • OS: iOS 15 Pro Max
  • Browser Chrome
  • Version 17.5

Additional context
"@stripe/stripe-react-native": "^0.41.0",
"react": "18.3.1",
"react-native": "0.76.5",

I have also changed the styles.xml to support the Material theme which is required for the CardForm to work and not to crash the Android app

<resources> <style name="AppTheme" parent="Theme.Material3.Light.NoActionBar"> <item name="android:editTextBackground">@drawable/rn_edit_text_material</item> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> </resources>

build.gradle
`
buildscript {
ext {
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.4.0")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}

apply plugin: "com.facebook.react.rootproject"
`

here is the code

<CardForm style={styles.cardForm} cardStyle={styles.cardStyle(cardError)} placeholders={{ number: 'xxxx xxxx xxxx xxxx', expiration: 'MM/YY', cvc: 'CVC', postalCode: 'Postal Code', }} onFormComplete={cardDetails => { console.log(Platform.OS, 'onFormComplete', cardDetails); setCard(cardDetails); }} />

here are the logs for ios
ios onFormComplete {"brand": "Visa", "complete": true, "country": "PK", "expiryMonth": 4, "expiryYear": 2030, "last4": "4242", "postalCode": "4"}

I'm unable to get any logs for Android, which means the onFormComplete is not even triggered

@haris18896
Copy link
Author

I was able to resolve the issue by setting newArchEnabled=false in the gradle.properties file. It appears that the latest version of the Stripe SDK does not fully support the new architecture introduced in React Native.

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

No branches or pull requests

1 participant