【问题标题】:Magic.link React Native cannot import WebView from react-nativeMagic.link React Native 无法从 react-native 导入 WebView
【发布时间】:2021-11-29 21:09:37
【问题描述】:

正在使用 react-native 实现 magic.link,但在导入 Magic 时出现错误

import { Magic } from "@magic-sdk/react-native";

错误:

Attempted import error: 'WebView' is not exported from 'react-native'.

我认为它是因为 react-native-webview 的子依赖项已被删除,但我确实安装了它。 npm install --save react-native-webview@^8.0.0 如教程所说?现在卡了一段时间,不知道如何继续使用魔法

https://magic.link/docs/login-methods/email/integration/react-native

此链接附加到文档 https://github.com/react-native-webview/react-native-webview/issues/373 。但不知道为什么它不起作用,因为安装了正确的 react-native-webview 依赖项(8.0.0)或(^8.0.0,即 8.2.1)

我按照教程的建议安装了软件包

yarn add @magic-sdk/react-native

# Ensure the required `peerDependencies` are installed
yarn add react-native-webview@^8.0.0

【问题讨论】:

    标签: react-native


    【解决方案1】:

    使用这个:

    npm install --save @magic-sdk/react-native 
    

    然后尝试使用 npm react-native link 链接它

    【讨论】:

    • 是的,我按照教程的建议安装了这些软件包。更新了问题。
    猜你喜欢
    • 1970-01-01
    • 2020-11-28
    • 1970-01-01
    • 2021-04-27
    • 2017-10-10
    • 1970-01-01
    • 2020-08-21
    • 2016-12-26
    • 2019-03-13
    相关资源
    最近更新 更多