iaphub / react-native-iaphub

The easiest way to implement IAP (In-app purchase) in your React Native app.
https://www.iaphub.com/
MIT License
319 stars 21 forks source link

undefined is not a function - iOS #81

Closed RazaShehryar closed 3 years ago

RazaShehryar commented 3 years ago

Hello,

I am facing issue with the .init function as whenever I try to write it in the App.js, it gives me an error "undefined is not a function". I am using react-native-iap 5.1.1 version. Here's the code.

useEffectAsync(async () => { try { await Iaphub.init({ appId: APP_ID, apiKey: CLIENT_KEY, environment: "production", }); await Iaphub.setUserId(DeviceInfo.getUniqueId()); } catch (e) { console.log(e); } }, []);

Let me know if there's something wrong that I am doing.

RazaShehryar commented 3 years ago

Nevermind, I was defining it as import * as Iaphub from 'react-native-iaphub'. It should have been import Iaphub from 'react-native-iaphub'.

Closing this issue now.