Superwall
The shared instance of Superwall that provides access to all SDK features.
Deprecated SDK
We strongly recommend migrating to the new Superwall Expo SDK, see our migration guide for details.
You must call configure() before accessing Superwall.shared, otherwise your app may crash or behave unexpectedly.
Purpose
Provides access to the configured Superwall instance after calling configure().
Signature
static get shared(): SuperwallParameters
This is a static property with no parameters.
Returns / State
Returns the shared Superwall instance that was configured via configure().
Usage
Configure first (typically in your app's entry point):
import Superwall from "@superwall/react-native-superwall"
await Superwall.configure({
apiKey: "pk_your_api_key"
})Then access throughout your app:
Superwall.shared.register({
placement: "feature_access",
feature: () => {
// Feature code here
}
})Set user identity and attributes:
await Superwall.shared.identify({
userId: "user123"
})
await Superwall.shared.setUserAttributes({
plan: "premium",
signUpDate: new Date()
})Set delegate:
import { SuperwallDelegate } from "@superwall/react-native-superwall"
class MyDelegate extends SuperwallDelegate {
subscriptionStatusDidChange(from, to) {
console.log(`Subscription status changed from ${from} to ${to}`)
}
}
await Superwall.shared.setDelegate(new MyDelegate())Main Methods
register()- Register a placement to trigger paywallsidentify()- Identify a usergetUserAttributes()- Get user attributessetUserAttributes()- Set user attributeshandleDeepLink()- Handle deep linksgetSubscriptionStatus()- Get subscription statussetSubscriptionStatus()- Set subscription status
How is this guide?
Edit on GitHub