RevenueCat / RevenueCat/react-native-purchases

Calling setState while Paywall is being presented causes paywall to close on iOS

Open
#1,123 1 comment 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
A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

  1. Environment
    1. Platform: iOS
    2. SDK version: 8.2.1
    3. OS version:
    4. Xcode/Android Studio version: Expo managed
    5. React Native version: 0.74.5
    6. SDK installation (CocoaPods + version or manual): cocoapods
    7. How widespread is the issue. Percentage of devices affected. All
  2. Debug logs that reproduce the issue: No logs provided
  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
If I present the paywall from a modal that is triggered by a setState mutation, then want to close that modal while presenting the paywall, the paywall either opens and immediately closes or never opens to begin with.

const closeModalAndShowPaywall = () => {
    setIsModalShowing(false)     <-- setting state
    const paywallResult: PAYWALL_RESULT = await RevenueCatUI.presentPaywall({
      fontFamily: "Roboto",
    });
}

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 by reproducing the interaction between setIsModalShowing(false) and RevenueCatUI.presentPaywall on iOS with the stated React Native and SDK versions. Compare the paywall's behavior with and without the state update, then add or update a focused regression test if the relevant entry point is identified; done means the paywall remains presented after the modal is closed.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.