chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
890 stars 185 forks source link

InAppUtils gives me undefined #132

Closed iSaadSalman closed 6 years ago

iSaadSalman commented 6 years ago

First I installed with NPM like so: npm install react-native-in-app-utils --save and then with rnpm.

Importing like so const { InAppUtils } = NativeModules and still gives me undefined

chirag04 commented 6 years ago

try to link it manually

iSaadSalman commented 6 years ago

@chirag04 and how would I do that? I'm bit new to RN. Thanks

I'm using expo as well just to let you know

raduflp commented 6 years ago

@iSaadSalman pretty sure you have to eject your app to make use of modules requiring native code

chirag04 commented 6 years ago

expo doesn't allow adding native modules like this directly i think. like @raduflp said, you probably will have to eject. Going to close this. let me know if you need more info.

yoonsy commented 6 years ago

If anybody who faced this issue and having ios/Podfile, try to run cd ios && pod install. And maybe you need to add following code to your Podfile to resolve duplicate React module error.

  rn_path = '../node_modules/react-native'

  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path
ZainaliSyed commented 6 years ago

Reference Stack overflow answer Install Library (react-native-in-app-utils) using rnpm. you need to install rnpm.

1.npm install rnpm -g

  1. rnpm install react-native-in-app-utils

rnpm will auto link your library for IOS.

prestonlanetz commented 4 years ago

@ZainaliSyed thank u so much. I used rnpm and it works!