presentCustomerCenter throws in preview API mode when callbacks are passed
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react-native, typescript
Research direction
Start with react-native-purchases-ui/src/preview/nativeModules.ts and trace how RevenueCatUI.presentCustomerCenter handles the preview module’s return value and callback cleanup. The issue describes a Jest reproduction using the real preview module; use it to verify the call returns a promise with and without callbacks. Done means both calls resolve without throwing in preview mode.
Written by the indexing model from the issue text.
Description
Describe the bug
In preview API mode (Expo Go, Rork sandbox, web), RevenueCatUI.presentCustomerCenter({ callbacks }) throws synchronously:
TypeError: Cannot read properties of null (reading 'finally')
The preview RNCustomerCenter module (react-native-purchases-ui/src/preview/nativeModules.ts) returns null from presentCustomerCenter, and RevenueCatUI.presentCustomerCenter calls .finally() on that value to remove its event listeners. Without callbacks, the method returns null instead of the declared Promise<void>, so .then() on the result throws as well.
-
Environment
- Platform: Expo Go / web (preview API mode)
- SDK version: react-native-purchases-ui 10.15.0 (current
main) - OS version: any
- Xcode/Android Studio version: n/a
- React Native version: any
- SDK installation (CocoaPods + version or manual): npm
- How widespread is the issue. Percentage of devices affected: every preview-mode call that passes
callbacks
-
Debug logs that reproduce the issue
A jest test that loads the real preview module and calls RevenueCatUI.presentCustomerCenter({ callbacks }) fails with:
TypeError: Cannot read properties of null (reading 'finally')
-
Steps to reproduce, with a description of expected vs. actual behavior
-
Run with the preview native modules (Expo Go or web).
-
Call
RevenueCatUI.presentCustomerCenter({ callbacks: { onRestoreStarted: () => {} } }).
Expected: the call returns a promise that resolves (the method logs that it has no effect in preview mode).
Actual: the call throws TypeError: Cannot read properties of null (reading 'finally').
- Other information
Returning a resolved promise from the preview module fixes both call paths.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 124
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 69
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RevenueCat/react-native-purchases
-
`entitlementVerificationMode` defaults to `DISABLED` and overrides the native default (`INFORMATIONAL`)Possibly taken @AlvaroBrey claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RevenueCat/react-native-purchases#2127 ·
Maintainers usually reply within 1 day
-
AdMob: show-time placement override persists after the ad is loaded againPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RevenueCat/react-native-purchases#2104 ·
Maintainers usually reply within 1 day
-
TypeScript helpers (`__awaiter`, `__generator`, `__createBinding`, …) are inlined in every file of `dist`Possibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RevenueCat/react-native-purchases#2079 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
RevenueCat/react-native-purchases#1912 ·
Maintainers usually reply within 1 day
-
presentCustomerCenter never resolves when it can't presentPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
RevenueCat/react-native-purchases#2098 · 1 comment ·
Maintainers usually reply within 1 day
All issues in RevenueCat/react-native-purchases
Similar issues
-
Bug: Cloudflare Pages static _redirects identity rule causes RSC Flight to reload as HTMLPossibly taken @Donvero claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Mantitup-Org/vista#210 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
simstudioai/sim#9831 ·
Maintainers usually reply within 1 day
-
status: waiting for maintainer
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
mui/material-ui#49751 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
diplodoc-platform/transform#1184 ·
Maintainers usually reply within 1 day