【问题标题】:Expo Go Stripe: Native module cannot be nullExpo Go Stripe:本机模块不能为空
【发布时间】:2021-11-04 14:08:13
【问题描述】:

我相信 Expo-Go 现在可以支持 Stripe 支付(基于 here 提供的更新文档。)

我正在使用 Expo SDK 版本 40。

我表演

"expo install @ stripe/stripe-react-native"

以确保我得到正确的版本。

然后我尝试使用以下命令将 Stripe 导入我的项目:

import { StripeProvider } from '@stripe/stripe-react-native'

项目一刷新,应用就会崩溃并抛出大约 25 个错误/警告,最常见的是“Native module cannot be null”错误

还有其他人遇到过这个错误吗?

【问题讨论】:

    标签: javascript react-native expo stripe-payments


    【解决方案1】:

    我正在使用 Expo SDK 版本 40。

    我相信你必须使用更高的版本,比如 41/42,所以我会尝试更新它。根据您分享的链接,您会注意到 https://docs.expo.dev/versions/v41.0.0/sdk/stripe/ 存在,但 https://docs.expo.dev/versions/v40.0.0/sdk/stripe/ 不存在。

    https://github.com/stripe/stripe-react-native/issues/467#issuecomment-889217595

    https://github.com/stripe/stripe-react-native/issues/256#issuecomment-846922117

    【讨论】:

    • 那不会影响我的整个构建吗?
    • 它可能会影响您使用的某些东西,是的,但这就是 Expo 处理引入的依赖项的方式。您需要查看 Expo 变更日志中的重大更改,并查看您需要处理的内容。 github.com/expo/expo/blob/master/CHANGELOG.md
    • 对不起,我没有看到这个回复。这对我有用,我升级到 SDK 42。感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-12
    • 2020-04-30
    • 1970-01-01
    • 2019-05-21
    • 2020-12-13
    • 1970-01-01
    • 2023-01-17
    相关资源
    最近更新 更多