Sticky

React-Native / Expo Go: How to solve `TypeError: null is not an object (evaluating 'RNPurchases.setupPurchases')`

  • 29 August 2022
  • 2 replies
  • 1664 views

Userlevel 5
Badge +8
  • RevenueCat Staff
  • 204 replies

Expo Go doesn’t build native modules, so you may run into this error while trying to run your app with react-native-purchases in Expo Go. 

 

In order to use RevenueCat with Expo, you will have to create Development Builds, which can be done either by using EAS, or by making builds that are compatible with Xcode and Android Studio. 

There are detailed instructions for doing either one in this page:

https://docs.expo.dev/development/build/

 

Easiest way to be able to debug is to just run either of the following:

npx expo run:android -d

npx expo run:ios -d

 

We also have a blog post that goes step-by-step into how to make an app with Expo and RevenueCat using EAS: https://www.revenuecat.com/blog/in-app-puchase-expo-managed-workflow/

 

Let us know if you run into any issues! 


2 replies

Badge

@Andy This makes sense for me  that I can only test IAP under a build development. But I would like to keep using my app testing in ExpoGo even if IAP are not working.

I tried to import conditionally the library but seems doesn't work that way in React Native

Any clue how can I keep debugging my app in ExpoGo? no matter if IAP doesn't work.

 

import { IsExpoGo, RevenueCatAPIKeys } from "./lib/constants";

if(!IsExpoGo){
import Purchases, { PurchasesOffering } from 'react-native-purchases';
}
Badge +3

@Alejandro Did you ever find a solution to this?

Reply