react-native-checkout-mercadopago icon indicating copy to clipboard operation
react-native-checkout-mercadopago copied to clipboard

Type error: undefined is not an object (CheckoutMercadoPagoModule.startCheckout)

Open githubmss opened this issue 6 years ago • 3 comments

I am getting above mentioned error after installing the plugin to my project, this is how my app.js file looks like :

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
  TouchableOpacity
} from 'react-native';
import { startCheckout } from 'react-native-checkout-mercadopago';

// const Mercadopago = NativeModules.CheckoutMercadoPagoModule;

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity style={styles.button} onPress={() => this.callMercado()}>
          <Text>Press</Text>
        </TouchableOpacity>
      </View>
    );
  }
  callMercado() {
    let payment = startCheckout('TEST-ad365c37-8012-4014-84f5-6c895b3f8e0a', '176234066-fc6d5d5e-2671-4073-ab49-362a98b720b5').then(success => { console.log("success") }, error => { console.log("error")})
    //  Mercadopago.startCheckout('TEST-ad365c37-8012-4014-84f5-6c895b3f8e0a', '176234066-fc6d5d5e-2671-4073-ab49-362a98b720b5').then(success => { console.log("success") }, error => { console.log("error")});
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  button: {
    borderWidth: 1,
    borderColor: 'rgba(0,0,0,0.2)',
    alignItems: 'center',
    justifyContent: 'center',
    width: 100,
    height: 100,
    backgroundColor: '#fff',
    borderRadius: 100,
  },
});

Please let know how can I resolve this error. I need to integrate this into my project it's my client requirement Regards

githubmss avatar Jun 12 '18 07:06 githubmss