简体   繁体   English

不需要一个模块

[英]Can't require one module

I have some trouble for using react-native-paypal. 我在使用react-native-paypal时遇到了一些麻烦。

let PayPal = require('react-native-paypal');

I have this error: Requested keys of a value that is not an object . Requested keys of a value that is not an object此错误: Requested keys of a value that is not an object I also try let PayPal = require('../node_modules/react-native-paypal'); 我也尝试let PayPal = require('../node_modules/react-native-paypal'); but it didn't work too. 但它也不起作用。 I don't know what to do. 我不知道该怎么办。

Solution: I use paypal-react-native-wrapper but now I have undefiend is not an object when I initialize the paiement. 解决方案:我使用paypal-react-native-wrapper,但是现在我在初始化部分时没有undefiend不是对象。 The error is at the first point . 错误是第一点。

    PayPal.initialize(PayPal.SANDBOX, "AbyfNDFV53djg6w4yYgiug_JaDfBSUiYI7o6NM9HE1CQ_qk9XxbUX0nwcPXXQHaNAWYtDfphQtWB3q4R");
PayPal.pay({
  price: '40.70',
  currency: 'MYR',
  description: 'Your description goes here',
}).then(confirm => console.log(confirm))
  .catch(error => console.log(error));

Thank for your answer. 感谢您的回答。

Do

import PayPal from 'react-native-paypal';

If this doesn't work, try installing 'react-native-paypal-wrapper' and then do 如果这不起作用,请尝试安装“ react-native-paypal-wrapper”,然后执行

import PayPal from 'react-native-paypal-wrapper';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM