RevenueCat / RevenueCat/react-native-purchases
Calling setState while Paywall is being presented causes paywall to close on iOS
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 117
- Avg merge
- 14h 40m
- Merged PRs (30d)
- 40
Description
- [ X] I have updated Purchases SDK to the latest version
- [ X] I have read the Contribution Guidelines
- [X ] I have searched the Community
- [ X] I have read docs.revenuecat.com
- [ X] I have searched for existing Github issues
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.
- Environment
- Platform: iOS
- SDK version: 8.2.1
- OS version:
- Xcode/Android Studio version: Expo managed
- React Native version: 0.74.5
- SDK installation (CocoaPods + version or manual): cocoapods
- How widespread is the issue. Percentage of devices affected. All
- Debug logs that reproduce the issue: No logs provided
- Steps to reproduce, with a description of expected vs. actual behavior
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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