我正在尝试使用新推出的 @stripe/stripe-react-native 包将 Stripe 支付链接到 React Native cli 电子商务应用程序,但在向 Stripe 提供程序元素提供可发布密钥时,我在 Android 模拟器中遇到错误
TypeError:null不是对象(评估'_NativeStripeSdk.default.initialise')
我尝试使用普通模板将 stripe 包与另一个新创建的 React Native cli 应用程序集成,但仍然遇到相同的错误。我还使用 React Web 应用程序检查了条带可发布密钥,它工作正常。
这是我的 App.js
import {StripeProvider} from '@stripe/stripe-react-native';
import React from 'react';
import {StyleSheet, View, Text} from 'react-native';
const App = () => {
return (
<StripeProvider publishableKey="pk_test_51IeDvNS......">
<View>
<Text>Hello World...</Text>
</View>
</StripeProvider>
);
};
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误
ERROR TypeError: null is not an object (evaluating '_NativeStripeSdk.default.initialise')
This error is located at:
in StripeProvider (at App.js:17)
in App (at renderApplication.js:45) …Run Code Online (Sandbox Code Playgroud) stripe-payments reactjs react-native react-native-stripe-api