bamlab / react-native-braintree-payments-drop-in

React Native integration of Braintree Drop-in
MIT License
35 stars 31 forks source link

BraintreeDropIn is undefined #11

Closed mrigo closed 5 years ago

mrigo commented 5 years ago

Hello, I've tried the basic example in my app. With this in my component import BraintreeDropIn from 'react-native-braintree-payments-drop-in';

And this

BraintreeDropIn.show({
      clientToken: token,
    })
    .then(result => console.log(result))
    .catch((error) => {
      if (error.code === 'USER_CANCELLATION') {
        // update your UI to handle cancellation
      } else {
        // update your UI to handle other errors
      }
    });

In iOS I've the error

Cannot read property 'show' of undefined

I've setup all my project like the readme explain, but I can't have the BraintreeDropIn class included, it's always undefined!!! But the file are present in node_modules and the path are correct!

What am I doing wrong?! Please help, I'm stuck too long on this :(

Thanks!

mrigo commented 5 years ago

The problem is that the index.js of the package contains const { RNBraintreeDropIn } = NativeModules;

but there's no RNBraintreeDropIn in the NativeModules! What's is missing in the iOS setup? I've done all the steps!

Minishlink commented 5 years ago

Hello @mrigo, when you did react-native link react-native-braintree-payments-drop-in, something must have gone wrong. Verify that either your Podfile has changed and you ran pod install, or that your pbxproj has changed.

Adarwall commented 5 years ago

@mrigo have you found the solution?

mrigo commented 5 years ago

Hi, yes I linked manually the libraries because the react-native link and the pod install commands doesn't work. Now I'm able to use the Drop In!

Adarwall commented 5 years ago

Thank you for your answer! can you please specify how did you link it all manually? I try to but it doesn't work...

mrigo commented 5 years ago

I've tried only in iOS, I've added the project in node_module/dropin/ios/ with "add files to" in XCode and then in "build phases" added the dropin library.

alleniver commented 5 years ago

This Component will be update?

Minishlink commented 5 years ago

@alleniver There's no need to update it AFAIK, those are configuration problems.

ShaharyarMaroof commented 4 years ago

hey @Minishlink I'm using the version 1.2.1 of the library on react 0.60.6, but I can't get it to work on iOS. I have followed the steps in the readme. Im getting the error as well. image

ShaharyarMaroof commented 4 years ago

@Minishlink never mind, I got it running by reinstalling my pods. Thanks!