Type Errror: Super expression must either be null or a function (GiftedChat)

Viewed 497

I am using GiftedChat npm for chatting mechanism in react native. It was working fine in lower react native version. I have upgraded react native version to 0.62.0

Now I am getting and exception from GiftedChat saying "TypeError: super expression must be null or function" . Error occurring in android device. See attached screenshot for details.

enter image description here

How to solve this?

Any kind of suggestion would be appreciated.

2 Answers

I solved the same issue by executing npm install react-native-gifted-chat@0.2.x --save and didn't get that problem anymore.

There is an issue opened on Gifed Chat github repo

which describes the same problem there and provides couple of temporary solutions i myself am using this

But you need to reset your previous installation in your npm modules here's what i did

  1. Find "react-native-gifted-chat" in your package.json
    "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. delete "react-native-gifted-chat"
  2. go to root folder and delete node_modules and package-lock.json
  3. in your package.json paste
        "react-native-gifted-chat": "git+https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet"

where your previous "react-native-gifted-chat" entry was

  1. reinstall npm modules by launching npm install in root folder
  2. this worked for me and got rid of this error

Still you should subscribe to Gifted Chat repository to look for updates, since when the official update comes out, you would want to go back to official npm package. Because User who provided temporary fix migh delete their repository. To watch for updates click on eye icon in Gifted Chat repository. Gifted Chat github

Also if you are afraid that user who provided their temporary solution might delete their repo prematurely, you could fork Gifted Chat repo, fix errors and use it instead.

Related