Bridge togglePaywallSpinner to Expo - #225
Merged
ianrumac merged 1 commit intoSep 13, 2026
Merged
Conversation
commit: |
ianrumac
force-pushed
the
feat/toggle-paywall-spinner
branch
from
September 13, 2026 11:48
3b5fcaa to
bc3ac15
Compare
Contributor
|
Thnks for the PR @actuallyhoss , merging it in for upcoming release! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gap
Both native SDKs expose
togglePaywallSpinner(isHidden:)and document it identically, as the thing you reach for when a custom paywall action does async work:Superwall.swift:1007on iOS,Superwall.kt:799on Android. There are no references to it anywhere in this package.The custom action itself is fully bridged. An app can already receive one via
handleCustomPaywallActionon the delegate oronCustomCallbackonusePlacement, and can already do async work in response, but there's no way to make the paywall look busy while that runs. It just sits there looking frozen.togglePaywallSpinnerpublic and documentedusePlacement, compat)togglePaywallSpinnerin ExpoThe change
A sync
Functionon both platforms matching the native signature. Both native implementations dispatch internally and no-op when no paywall is presented, so there's nothing to await and nothing that can throw. The store method isasynconly because it waits onawaitConfigured()first, in line with every other call in that store.ios/SuperwallExpoModule.swift,android/.../SuperwallExpoModule.kt: the native modulessrc/SuperwallExpoModule.ts: the module typesrc/useSuperwall.ts,src/compat/index.ts: both SDK surfacesREADME.md: Hooks API Reference, next todismissexample/app/new.tsx: the existingonCustomCallbackreturned immediately; it now shows the spinner across a two second delay, with the hide in afinallyso a throw can't leave it spinningTesting
tsc --noEmiton the package, and on the example app (clean apart from a pre-existing style typing error inarticle-paywall.tsx, untouched here).The new case in
sdk.behavior.test.tsxsits alongside the existing "waits for configure" tests and asserts the call is queued until configure resolves, then passes the boolean through both ways. I checked it's load bearing by swapping the store's native call for a no-op, which turns it red.I don't have a macOS or Android toolchain to hand, so the Swift and Kotlin haven't been compiled locally and I haven't watched the spinner run on a device. Both native additions are four lines against a documented public API and sit alongside identical
Functionblocks, so I'd expect them to be fine, but CI should confirm the compile and it's worth someone eyeballing it on a device.