How to make hard paywall in react native?
Best answer by alejandra-wetsch
Hi there,
Thank you for reaching out!
For React Native, we have different ways to display paywalls using the SDK:
- Using
RevenueCatUI.presentPaywall
: This method will present a paywall immediately when called. - Using
RevenueCatUI.presentPaywallIfNeeded
: This will present a paywall only if the customer does not have an unlocked entitlement. - Manual presentation of the paywall using
RevenueCatUI.Paywall
: This approach gives you more flexibility when displaying the paywall.
In your case, given that you want to create a hard paywall, using RevenueCatUI.Paywall
is the best approach. Depending on which Paywall Template version you're using, you should implement different configurations to ensure that dismissing the paywall is not an option for the user.
If you're using Legacy Paywall templates, you can use the configuration below:
<View style={{ flex: 1 }}>
<RevenueCatUI.Paywall
options={{ displayCloseButton: false }} // setting this property to `false` will remove the close button from the paywall if any
onPurchaseCompleted={handlePurchaseCompleted}
/>
</View>
However, if you're using New Paywall templates, you should remove the Close Button from the paywall while editing it. In that way, no Close Button will appear, and the user won't be able to dismiss it. Please refer to the code below on how to configure the paywall in this case:
<View style={{ flex: 1 }}>
<RevenueCatUI.Paywall
onPurchaseCompleted={handlePurchaseCompleted}
/>
</View>
Thank you also for your documentation feedback. We will make sure to take it into consideration and will make changes so that this information is accessible and easy to find.
I hope this helps you. Please let us know if you have any other questions!
Best,
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.