kraffslol / react-native-braintree-xplat

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

Infinite loading when calling BTClient.showPaymentViewController #105

Open unpokolokko opened 5 years ago

unpokolokko commented 5 years ago

Everytime my app user choose Braintree as payment options i will call to setup the BTClient based on platform(ios/android) , see code below :

//setup BTClient

if (Platform.OS === "ios") {
      BTClient.setupWithURLScheme(token, "com.abc.abc");
    } else {
      BTClient.setup(token);
    }
}

And then I call over :

BTClient.showPaymentViewController({
        bgColor: "#FFF",
        tintColor: "#ff6600",
        barBgColor: "#0066cc",
        barTintColor: "white"

}) .then(function(nonce) {
   //do something here

}).catch(function(err){

//do something here

}

But what happened is, it just showing loading page and seemed to stuck there.

screen shot 2018-10-18 at 2 15 08 pm

This never happens before and only happens in certain Android phones.Works fine in certain Android phone. I checked in iOS , seemed like this problem didn't occur in iOS.

"react-native": "^0.49.0", "react-native-braintree-xplat": "^4.0.0",

Thanks.

HassanRaza03 commented 5 years ago

any solution..?

unpokolokko commented 5 years ago

I think it might be caused by setup process is not yet complete before showpaymentviewcontroller is being called.

u need to make sure setup is first completed.

this is my workaround :

if (Platform.OS === "ios") {
      BTClient.setupWithURLScheme(token, "com.abc.abc");
    } else {
      await BTClient.setup(token);
    }
}

then :

 setTimeout(() => {
     BTClient.showPaymentViewController({
        bgColor: "#FFF",
        tintColor: "#ff6600",
        barBgColor: "#0066cc",
        barTintColor: "white"
  }) .then(function(nonce) {
        //do something here
  }).catch(function(err){
        //do something here
  });
}, 3000);