stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.28k stars 264 forks source link

fpx payment error - Can not perform this action after onSaveInstanceState on Android #1429

Closed inifaisal closed 1 year ago

inifaisal commented 1 year ago

Hi!

I'm still encountering this issue https://github.com/stripe/stripe-react-native/issues/887 using version 0.19.0, this issue only happen on certain mobile phone, for me it was on xiaomi and one plus devices.

Here is the diff that solved my problem:

diff --git a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt
index 468b9e1..d81f48f 100644
--- a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt
+++ b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt
@@ -111,7 +111,7 @@ class PaymentLauncherFragment(
         try {
           it.supportFragmentManager.beginTransaction()
             .add(fragment, TAG)
-            .commit()
+            .commitAllowingStateLoss()
         } catch (error: IllegalStateException) {
           promise.resolve(createError(ErrorType.Failed.toString(), error.message))
         }
charliecruzan-stripe commented 1 year ago

Is this hard-crashing your app? You should be able to retry after the promise resolves with an error

inifaisal commented 1 year ago

Is this hard-crashing your app? You should be able to retry after the promise resolves with an error

it's not making our app crash, but we cannot make the payment using fpx, the payment always error.

HatsuneMikuV commented 1 year ago

I encountered the same crash issue. image

Device: image

Version: 0.27.1 - 2023-05-03 stripe-android 20.24.0

charliecruzan-stripe commented 1 year ago

we cannot make the payment using fpx, the payment always error

@inifaisal I'm not able to reproduce this behavior in our test app

@HatsuneMikuV How are you able to reproduce that crash?

charliecruzan-stripe commented 1 year ago

closing this for inactivity