kraffslol / react-native-braintree-xplat

Cross-platform Braintree module for React Native
MIT License
81 stars 121 forks source link

iOS Error BTClient.setup - Cannot read property 'setup' of undefined #82

Closed serialbandicoot closed 6 years ago

serialbandicoot commented 6 years ago

I'm sure Im making a really obvious mistake, so can someone please point me in the right direction.

  1. npm install --save react-native-braintree-xplat
  2. react-native link
  3. componentDidMount() { var BTClient = require('react-native-braintree-xplat'); BTClient.setup('eyj2...'); }

I get the following error, I also checked the linking and it seems ok. However I get the following error.

Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'setup' of undefined

react-native: 0.52.0

dungnguyen10989 commented 6 years ago

the same issue :(

serialbandicoot commented 6 years ago

Any chance someone can suggest an idea to resolve this issue @dungnguyen10989 and I've got?

serialbandicoot commented 6 years ago

@dungnguyen10989 - I managed to get it working using package.json of:

"react": "16.0.0-alpha.6",
"react-native": "0.44.3",
"react-native-braintree-xplat": "^4.0.0"

My suggestion is to use the example provided, however I needed to run react-native upgrade on it and fix an issue with a linking error in Xcode.

After setting up the braintree sandbox account, you can replace the merchant_id, public_key, private_key in the ruby server below. Should help get you on your way! If ruby isn't your thing, there was plenty of other options!

I'm going to try and upgrade the react version further to see where it went wrong. I'll post if I get some results.

Braintree.zip

This was also the iOS(js) file..

index.ios.txt

Good luck!

dungnguyen10989 commented 6 years ago

@serialbandicoot, thank you for your suggestion, i'll try now