Fix CashApp return crash by preventing fragment state restoration

Prevent Stripe PaymentSheetFragment restoration crash when returning from
CashApp authorization by removing fragment state from saved instance bundle.

This fixes the rare crash:
"Unable to instantiate fragment com.reactnativestripesdk.PaymentSheetFragment:
could not find Fragment constructor"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-01-16 00:29:33 -08:00
parent e8c99844f8
commit 213bc5e401

View file

@ -1,5 +1,14 @@
package com.payfrit.app package com.payfrit.app
import android.os.Bundle
import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity : FlutterFragmentActivity() class MainActivity : FlutterFragmentActivity() {
// Fix crash when returning from CashApp/external payment authorization
// Stripe SDK fragments don't properly support state restoration
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
// Remove fragment state to prevent Stripe PaymentSheetFragment restoration crash
outState.remove("android:support:fragments")
}
}