Hooks
togglePaywallSpinner()
Show or hide the loading spinner on the currently presented paywall.
Purpose
Shows or hides the loading spinner on the currently presented paywall. This is the companion to onCustomCallback / handleCustomPaywallAction — use it when a custom paywall action kicks off asynchronous work and you want the paywall to look busy until it finishes. Does nothing if no paywall is currently presented.
Signature
Hook usage:
const { togglePaywallSpinner } = useSuperwall()
await togglePaywallSpinner(
isHidden: boolean
): Promise<void>Compat API usage:
import Superwall from "expo-superwall/compat"
await Superwall.shared.togglePaywallSpinner(
isHidden: boolean
): Promise<void>Parameters
Prop
Type
Returns / State
Returns a Promise<void> that resolves once the native SDK has been told. Always await Superwall.configure() (or wait for isConfigured) before calling.
Usage
import { useSuperwall } from "expo-superwall"
import { usePlacement } from "expo-superwall"
function SyncAccountPaywall() {
const { togglePaywallSpinner } = useSuperwall()
usePlacement({
onCustomCallback: async ({ name }) => {
await togglePaywallSpinner(false)
try {
const data = await syncAccount(name)
return { status: "success", data }
} finally {
await togglePaywallSpinner(true)
}
},
})
}Related
useSuperwall- Hook access to the main Expo SDK store.- Custom Paywall Actions - Respond to custom tap actions from a paywall.
How is this guide?