kraffslol / react-native-braintree-xplat

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

Android setup() + showPaymentViewController() flow hangs #64

Open mtimofiiv opened 6 years ago

mtimofiiv commented 6 years ago

On iOS, the flow works perfect. But the same code breaks on Android:

// snippet from an action:
async (token) => {
  try {
    const brainTreeOptions = {
        tintColor: config.color.brand,
        barBgColor: 'white',
        barTintColor: config.color.brand,
        bgColor: config.color.gradient[0],
        callToActionText: 'Save Card'
      }

      await BTClient.setup(token)
      const nonce = await BTClient.showPaymentViewController(brainTreeOptions)
  } catch (error) {
    // does not happen
  }
}

I suspect this is to do with the setup() promise being resolved too early.

Andreyco commented 6 years ago

Indeed. Also have this issue, for now solved with timeout on Android platform