RevenueCat / react-native-purchases

React Native in-app purchases and subscriptions made easy. Support for iOS and Android.
https://www.revenuecat.com
MIT License
691 stars 77 forks source link

react native purchases is not working in react native latest release 0.74 #1002

Closed stack-Rambo closed 1 month ago

stack-Rambo commented 1 month ago

This is the error i got while implementing Revenue cat SDK in react native latest version 0.74 ERROR Error configuring Purchases: [TypeError: _reactNativePurchases.default.setup is not a function (it is undefined)] This is the simple code i used . step1: downladed the package : npx install react-native-purchases step2: wrote this code in App.js file in React native and the above error message is displayed step3: code for APP.js import React,{useEffect} from 'react'; import { StatusBar } from 'react-native'; import Purchases from 'react-native-purchases'; import Router from './src/Route'; import { API_KEY } from './src/constants';

const App = () => { useEffect(() => { const configurePurchases = async () => { Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG); try {

    await Purchases.setup(API_KEY, null, false, false);
  } catch (error) {
    console.error('Error configuring Purchases:', error);
  }
};

configurePurchases();

}, []);

return ( <>

  <Router />
</>

); };

export default App;

RCGitBot commented 1 month ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

jameslporter commented 1 month ago

Seems fine for me on Android build but fails on iOS. Expo SDK 51.0.7

rikur commented 1 month ago

@stack-Rambo you must have upgraded from one major version to another, and hit some breaking changes.

There's no Purchases.setup() anymore, try:

Purchases.configure({ apiKey })
Jethro87 commented 1 month ago

@stack-Rambo As @rikur said, please use configure instead of setup. Documentation.