BlackBoxVision / react-native-mercadopago-px

🚀 MercadoPago PX bridge for react-native
https://react-native-mercadopago-px.blackbox-vision.tech
MIT License
103 stars 25 forks source link

Error in createPayment function - Expo #33

Closed MarioOlivera closed 3 years ago

MarioOlivera commented 3 years ago

Describe the bug

Hello, i use the library, and have error in the funcion "createPayment".

My code is same of example

The preferenceId is created success.

The execution of "createPayment" return the following error:

"null is not an object (evaluating '_reactNative.NativeModules.ReactNativeMercadopagoPx.createPayment')"

Smartphone (please complete the following information):

My package.json is the following: "@blackbox-vision/react-native-mercadopago-px": "^0.7.2", "@react-native-async-storage/async-storage": "^1.13.2", "@react-native-community/masked-view": "0.1.10", "@react-native-picker/picker": "^1.9.3", "@react-navigation/drawer": "^5.11.4", "@react-navigation/native": "^5.8.10", "@use-expo/font": "^2.0.0", "axios": "^0.21.0", "expo": "~39.0.2", "expo-font": "~8.3.0", "expo-status-bar": "~1.0.2", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz", "react-native-gesture-handler": "~1.7.0", "react-native-paper": "^4.4.1", "react-native-reanimated": "~1.13.0", "react-native-safe-area-context": "3.1.4", "react-native-screens": "~2.10.1", "react-native-web": "~0.13.12"

correafer commented 3 years ago

@MarioOlivera i have the exact same phone, the exact same versions of expo and RN, and the exact same problem! Thanks for sharing

@JonatanSalas Do you need any help? I dont know exactly how to debug it, but since i really need this to work, i can offer some help

JonatanSalas commented 3 years ago

We'll make a repro case with the same versions so we can understand what's going on, and produce a fix for this issue.

MarioOlivera commented 3 years ago

I resolve the error, i generated the app in pure app react native. The function of library is working. The problem is with Expo. Expo not installed the librarys required (for example MP). It is the problem.

Excuse, Greetings from Gualeguaychu :)

correafer commented 3 years ago

Thank you very much @MarioOlivera !

Hay alguno work-arround para poder usar expo y la libreria, sin hacer el eject?

Te mando y saludo y gracias!

JonatanSalas commented 3 years ago

We recommend you using expo bare-workflow.

Full expo apps won't work because when coding you use the expo client. Our library has native dependencies that are not propagated to the expo client.

We'll add a section to the docs explaining with more detail why our library doesn't work with Expo.

Rusbelllozano commented 2 years ago

Hola, buen dia, yo tengo este mismo problema, con Android también, pero no estoy usando Expo

La consola me arroja este mismo mensaje: "null is not an object (evaluating '_reactNative.NativeModules.ReactNativeMercadopagoPx.createPayment')"

Device: Pixel 3 OS: Android Version 11

Este es mi package.json { "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint .", "postinstall": "jetifier -r && patch-package", "reload": "adb shell input text \"RR\"", "menu-dev": "adb shell input keyevent 82", "build-android": "cd android/ && ./gradlew bundleRelease && cd .." }, "dependencies": { "@blackbox-vision/react-native-mercadopago-px": "^0.7.2", "@invertase/react-native-apple-authentication": "^1.1.2", "@kesha-antonov/react-native-action-cable": "^1.0.5", "@react-native-community/datetimepicker": "^2.1.0", "@react-native-community/google-signin": "^3.0.2", "@sentry/react-native": "^1.0.9", "axios": "^0.19.0", "currency-formatter": "^1.5.5", "formik": "^1.5.8", "i18n-js": "^3.3.0", "moment": "^2.24.0", "patch-package": "^6.4.7", "react": "16.9.0", "react-moment": "^0.9.6", "react-native": "0.61.5", "react-native-code-push": "^6.1.0", "react-native-device-info": "^4.0.1", "react-native-fbsdk": "^1.1.1", "react-native-firebase": "~5.5.6", "react-native-gesture-handler": "^1.6.0", "react-native-image-picker": "^1.1.0", "react-native-intercom": "^13.1.0", "react-native-linear-gradient": "^2.5.6", "react-native-modal": "^11.4.0", "react-native-phone-input": "0.2.1", "react-native-picker-select": "^6.3.3", "react-native-reanimated": "^1.3.0", "react-native-safe-area-context": "^0.6.4", "react-native-safe-area-view": "^1.0.0", "react-native-screens": "1.0.0-alpha.23", "react-native-shadow": "^1.2.2", "react-native-snap-carousel": "^3.8.2", "react-native-svg": "^9.11.1", "react-native-switch-selector": "^2.0.0", "react-native-vector-icons": "^7.1.0", "react-native-walkthrough-tooltip": "^1.1.3", "react-native-webview": "^8.1.2", "react-navigation": "^4.0.10", "react-navigation-stack": "^1.9.4", "react-navigation-tabs": "^2.5.6", "react-redux": "^7.2.0", "redux": "^4.0.4", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0", "rn-content-loader": "^0.0.4", "yup": "^0.27.0" }, "devDependencies": { "@babel/core": "^7.6.4", "@babel/runtime": "^7.6.3", "@react-native-community/eslint-config": "^0.0.5", "@react-native-community/toolbar-android": "^0.2.1", "babel-jest": "^24.9.0", "babel-plugin-module-resolver": "^4.0.0", "eslint": "^6.5.1", "jest": "^24.9.0", "jetifier": "^1.6.4", "metro-react-native-babel-preset": "^0.56.0", "react-devtools": "^3", "react-test-renderer": "16.9.0", "reactotron-react-native": "^4.0.2", "reactotron-redux": "^3.1.2" }, "jest": { "preset": "react-native" } }

JonatanSalas commented 2 years ago

Tenes algun repo a mano para poder revisarlo y tirarte un centro?

Rusbelllozano commented 2 years ago

@JonatanSalas, un repo al público no tenemos, podria mostrar como estoy llamando al método, ya que cuando hago pruebas en IOS me funciona correctamente, te sirve que te mande pantallazos de esa parte?

JonatanSalas commented 2 years ago

Dale, todo lo que puedas agregar suma.

Rusbelllozano commented 2 years ago

En la parte superior se llama de esta manera import MercadoPagoCheckout from '@blackbox-vision/react-native-mercadopago-px';

Captura de pantalla 2022-01-19 a las 7 38 42 p  m

la creación del preference funciona correctamente y como te comento para IOS me funciona bien, pero al momento de probarlo para Android, la consola solo me arroja ese error

"null is not an object (evaluating '_reactNative.NativeModules.ReactNativeMercadopagoPx.createPayment')"

Agregue en el build.gradle algo como esto, pero tampoco obtuve buenos resultados dependencies { implementation project(':react-native-firebase') implementation project(':react-native-intercom') implementation 'com.mercadopago.android.px:checkout:4.+' }

JonatanSalas commented 2 years ago

Me suena a que a nivel app no esta linkeando el package, podras probar haciendo: react-native link --platforms android?

Despues de eso hacete ungradlew clean y correte el build de android para que te genere un nuevo APK.

Rusbelllozano commented 2 years ago

Acabo de realizar los pasos que me dices @JonatanSalas, pero tengo otro problema un poco aparte, no se si te ha sucedido alguna vez algo similar y me puedas ayudar?

`BUILD FAILED in 12s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

What went wrong: Could not determine the dependencies of task ':react-native-intercom:compileDebugAidl'. Could not resolve all task dependencies for configuration ':react-native-intercom:debugCompileClasspath'. Could not resolve androidx.appcompat:appcompat:{strictly 1.0.0}. Required by: project :react-native-intercom Cannot find a version of 'androidx.appcompat:appcompat' that satisfies the version constraints: Dependency path 'enlauApps:react-native-intercom:unspecified' --> 'com.facebook.react:react-native:0.61.5' -- 'androidx.appcompat:appcompat:1.0.2' Constraint path 'enlauApps:react-native-intercom:unspecified' --> 'androidx.appcompat:appcompat:{strictly 1.0.0}' because of the following reason: debugRuntimeClasspath uses version 1.0.0 Dependency path 'enlauApps:react-native-intercom:unspecified' --> 'io.intercom.android:intercom-sdk-base:5.5.1' --> 'androidx.appcompat:appcompat:1.0.0' Dependency path 'enlauApps:react-native-intercom:unspecified' --> 'io.intercom.android:intercom-sdk-base:5.5.1' --> 'com.google.android.material:material:1.0.0' --> 'androidx.appcompat:appcompat:1.0.0'`

JonatanSalas commented 2 years ago

Fijate que el package que estas usando de react-native-intercom esta deprecado en favor del package oficial de intercom.

Rusbelllozano commented 2 years ago

Muchas gracias @JonatanSalas , ya quedo funcionando correctamente 👍

JonatanSalas commented 2 years ago

Genial!