Skip to content

Add number and boolean support for CustomVariable#1675

Merged
facumenzella merged 5 commits into
mainfrom
feature/custom-variables-number-boolean
Mar 18, 2026
Merged

Add number and boolean support for CustomVariable#1675
facumenzella merged 5 commits into
mainfrom
feature/custom-variables-number-boolean

Conversation

@facumenzella

Copy link
Copy Markdown
Member

Summary

  • Extends CustomVariableValue with number and boolean types (previously string-only)
  • Passes typed values over the RN bridge instead of converting to strings, letting native SDKs use them for conditional paywall logic
  • Updates Android bridge (BasePaywallViewManager, RNPaywallsModule) to read typed values via ReadableType dispatch
  • Updates iOS bridge (PaywallViewWrapper) to call setCustomVariableNumber:forKey: and setCustomVariableBool:forKey:
  • iOS RNPaywalls.m (presentPaywall path) needs no changes — PHC's PaywallProxy already handles typed values from the dictionary

Mirrors the Flutter implementation: RevenueCat/purchases-flutter#1683

Test plan

  • Unit tests pass (18 tests covering all types, mixed types, edge cases)
  • API tester type-checks pass (npm run apitest)
  • Manual test on iOS with number/boolean custom variables in a V2 paywall
  • Manual test on Android with number/boolean custom variables in a V2 paywall

🤖 Generated with Claude Code

Previously custom variables only supported string values. This adds
number and boolean types so the native SDKs can use typed values for
conditional paywall logic instead of converting everything to strings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
facumenzella and others added 2 commits March 16, 2026 15:34
Avoids a breaking change for any downstream code importing the old
symbol from the package entrypoint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Non-finite numbers can behave unpredictably across the RN bridge.
Skip them with a console warning instead of passing them through.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@vegaro vegaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small concerns

Comment thread react-native-purchases-ui/src/customVariables.ts
Comment thread react-native-purchases-ui/src/customVariables.ts
facumenzella and others added 2 commits March 18, 2026 17:58
- Add comment clarifying why getString needs null check (returns String?)
  while getDouble/getBoolean return primitives
- Remove unnecessary @deprecated tag from internal alias

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@facumenzella facumenzella enabled auto-merge (squash) March 18, 2026 17:02
@facumenzella facumenzella merged commit 3f58738 into main Mar 18, 2026
8 checks passed
@facumenzella facumenzella deleted the feature/custom-variables-number-boolean branch March 18, 2026 17:10
facumenzella pushed a commit that referenced this pull request Mar 18, 2026
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* Add offeringId override to trackCustomPaywallImpression (#1679) via
Rick (@rickvdl)
### 📦 Dependency Updates
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 17.52.0 (#1680)
via RevenueCat Git Bot (@RCGitBot)

## RevenueCatUI SDK
### ✨ New Features
* Add number and boolean support for CustomVariable (#1675) via Facundo
Menzella (@facumenzella)

---------

Co-authored-by: RevenueCat CI <dev+ci@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants