RevenueCat / RevenueCat/react-native-purchases

App Error After User Subscribes Through Present Paywall (Can not perform this action after onSaveInstanceState)

Open
#974 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
117
Avg merge
14h 40m
Merged PRs (30d)
40

Description

Describe the bug
Upon the client's subscription via reveneucat's paywall, upon closing the paywall, the following error occurs in my Android native module.

I've searched online and found several instances of this error, but none of the proposed solutions have worked, which leads me to suspect it may be a bug with reveneucat.

I'm using expo.

  1. Environment
    1. Platform: Android
    2. SDK version: 7.21.1
    3. OS version:
    4. Xcode/Android Studio version:
    5. React Native version: : "0.73.4",
    6. SDK installation (CocoaPods + version or manual):
    7. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1632) at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1672) at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:341) at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:306) at com.revenuecat.purchases.hybridcommon.ui.PaywallHelpersKt.presentPaywallFromFragment(PaywallHelpers.kt:50) at com.revenuecat.purchases.react.ui.RNPaywallsModule.presentPaywall(RNPaywallsModule.kt:82) at com.revenuecat.purchases.react.ui.RNPaywallsModule.presentPaywall(RNPaywallsModule.kt:41) at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:149) at com.facebook.jni.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:234) at java.lang.Thread.run(Thread.java:1012)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace locations in com.revenuecat.purchases.hybridcommon.ui.PaywallHelpers.kt at line 50 and com.revenuecat.purchases.react.ui.RNPaywallsModule.kt at lines 82 and 41. Trace the paywall presentation timing relative to Android activity state saving, then verify that subscribing through the paywall and closing it no longer produces the reported IllegalStateException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.