Hooks

useSuperwallEvents

Purpose

The useSuperwallEvents hook provides a low-level way to subscribe to any native Superwall event. This is useful for advanced use cases or for events not covered by the more specific hooks. Listeners are automatically cleaned up when the component using this hook unmounts.

Parameters

Prop

Type

SuperwallEventCallbacks

Prop

Type

SuperwallEventInfo

Prop

Type

PageViewData

Prop

Type

PaywallPageViewEvent

Prop

Type

PaywallInfo

Prop

Type

Product

Prop

Type

CustomerInfo (Android)

Prop

Type

SubscriptionTransaction (Android)

Prop

Type

NonSubscriptionTransaction (Android)

Prop

Type

Returned Values

This hook does not return any values (void). Its purpose is to set up and tear down event listeners.

Example

import { useSuperwallEvents } from "expo-superwall";

function EventLogger() {
  useSuperwallEvents({
    onSuperwallEvent: (eventInfo) => {
      console.log("Superwall Event:", eventInfo.event.event, eventInfo.params);
    },
    onSubscriptionStatusChange: (newStatus) => {
      console.log("Subscription Status Changed:", newStatus.status);
    },
    onPaywallPresent: (info) => {
      console.log("Paywall Presented (via useSuperwallEvents):", info.name);
    },
    onUserAttributesChange: (newAttributes) => {
      console.log("User Attributes Changed:", newAttributes);
      // Sync with analytics or update in-memory state
    },
  });
}

How is this guide?

On this page