【问题标题】:Type Errror: Super expression must either be null or a function (GiftedChat)类型错误:超级表达式必须为 null 或函数 (GiftedChat)
【发布时间】:2020-04-03 22:16:02
【问题描述】:

我正在使用 GiftedChat npm 作为 react native 的聊天机制。它在较低反应的本机版本中运行良好。我已将 react 原生版本升级到 0.62.0

现在我收到来自 GiftedChat 的异常说 "TypeError: super expression must be null or function" 。安卓设备发生错误。详情见附件截图。

如何解决?

任何形式的建议都将不胜感激。

【问题讨论】:

    标签: react-native react-native-gifted-chat


    【解决方案1】:

    我通过执行npm install react-native-gifted-chat@0.2.x --save 解决了同样的问题,并且不再遇到这个问题。

    【讨论】:

    • 我遇到了同样的问题,但我认为 0.2.x 可能太旧了。仅使用最新版本的一个版本,react-native-gifted-chat@0.12.x,对我来说至少可以解决这个问题。
    • react-native-gifted-chat@0.12.x 为我工作。谢谢@Iguananaut
    【解决方案2】:

    有一个问题打开on Gifed Chat github repo

    它在那里描述了相同的问题并提供了几个临时解决方案 我自己正在使用this

    但是你需要在你的 npm 模块中重置你之前的安装,这就是我所做的

    1. 在您的 package.json 中找到“react-native-gifted-chat”
        "dependencies": {
            "@types/lodash.uniqueid": "^4.0.6",
            "lodash.uniqueid": "^4.0.1",
            "react": "16.11.0",
            "react-native": "0.62.1",
            "react-native-gifted-chat":"<your current version>" //delete this line
        },
    
    1. 删除“react-native-gifted-chat”
    2. 到根目录删除node_modules和package-lock.json
    3. 在你的 package.json 中粘贴
            "react-native-gifted-chat": "git+https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet"
    

    你之前的“react-native-gifted-chat”条目在哪里

    1. 通过在根文件夹中启动 npm install 重新安装 npm 模块
    2. 这对我有用并且消除了这个错误

    您仍然应该订阅 Gifted Chat 存储库以查找更新,因为当官方更新发布时,您会想要回到官方 npm 包。因为提供临时修复的用户可能会删除他们的存储库。 要查看更新,请单击 Gifted Chat 存储库中的眼睛图标。

    此外,如果您担心提供临时解决方案的用户可能会过早删除他们的存储库,您可以分叉 Gifted Chat 存储库,修复错误并改用它。

    【讨论】:

      猜你喜欢
      • 2016-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-11
      • 2023-01-29
      • 2018-02-27
      • 2017-04-01
      相关资源
      最近更新 更多