React-native-gifted-chat: Latest React Native 0.62.0: Type Errror: Super expression must either be null or a function

Created on 26 Mar 2020  路  33Comments  路  Source: FaridSafi/react-native-gifted-chat

Issue Description

When upgrading to the latest version of RN 0.62.0 importing the package leads to Type Errror: Super expression must either be null or a function

Steps to Reproduce / Code Snippets

  1. Upgrade RN to 0.62.0.
  2. import { GiftedChat } from 'react-native-gifted-chat';
  3. Runtime error:
    Type Errror: Super expression must either be null or a function

Expected Results

Gifted Chat to load normally

Additional Information

Seems to spawn from GiftedChat.js line 3

  • Nodejs version: 12.16.1
  • React version: 16.11.0
  • React Native version: 0.62.0
  • react-native-gifted-chat version: 0.13.0
  • Platform(s) (iOS, Android, or both?): only tested on Android
  • TypeScript version: 3.8.3

Most helpful comment

I hacked together a fork w/ the new action-sheet using the currently released version here.
Use it with yarn add https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet or w/e the equivalent npm command is.

All 33 comments

+1, I got the same issue here

This issue is related to '@expo/react-native-action-sheet' module which is used by 'react-native-gifted-chat';
See the issue at https://github.com/expo/react-native-action-sheet/issues/161 and the pull request https://github.com/expo/react-native-action-sheet/pull/162

This issue is related to '@expo/react-native-action-sheet' module which is used by 'react-native-gifted-chat';
See the issue at expo/react-native-action-sheet#161 and the pull request expo/react-native-action-sheet#162

When is the plan to merge and release the same ? The pull request is not updating the dependency of the giftedchat.

+1

Admin, Please update the expo/react-native-action-sheet/issues package to 3.6.0 in the gifted chat

+1

+1 any one solution?

I see that this PR exists, which should solve the problem: https://github.com/FaridSafi/react-native-gifted-chat/pull/1712

But is it possible to install this specific branch/PR before it is released in a new version?

I hacked together a fork w/ the new action-sheet using the currently released version here.
Use it with yarn add https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet or w/e the equivalent npm command is.

to a temp solution, i upgraded the dependency @expo/react-native-action-sheet to version 3.6.0.

to a temp solution, i upgraded the dependency @expo/react-native-action-sheet to version 3.6.0.

How do i get the latest version of this ?

I also experience this error with following line
import { GiftedChat, Send, InputToolbar } from 'react-native-gifted-chat'
any solutions?

I am experiencing the same issue but only on Android using RN 0.62.2. Would it be possible to upgrade the dependency @FaridSafi and release a new version by perhaps using @StagasaurusRex branch? That one worked for me too. Thank you :)

My fork bypasses the build process and isn鈥檛 appropriate to merge. PR #1712 would be better.

Hi! i created this PR #1743
You can download the branch and test, i would appreciate it!

I'm also facing this issue, how to resolve this? Wait for latest version of gifted chat or use previous version of React Native?

Based on https://github.com/StagasaurusRex/react-native-gifted-chat/commit/58ae0c8969d4e472538ed7abcecbb4ce81114f5f, I forced using the new version of action sheet lib which fixes the issue.

  1. Add this to the top level of the package.json
  "resolutions": {
    "@expo/react-native-action-sheet": "^3.6.0"
  }
  1. run yarn again

  2. The error should be gone ~

Based on StagasaurusRex@58ae0c8, I forced using the new version of action sheet lib which fixes the issue.

  1. Add this to the top level of the package.json
  "resolutions": {
    "@expo/react-native-action-sheet": "^3.6.0"
  }
  1. run yarn again
  2. The error should be gone ~

But it doesn't work for me, first of all I changed the "@expo/react-native-action-sheet": "^3.4.1" version to 3.6.0 in the package.json file of react-native-gifted-chat then run npm install. It showed me the same error TypeError: Super expression must either be null or a function. But when I changed things in my project's package-lock.json file like mentioned in the link you provided. It now showed me this:

Screenshot_1587712410

@imAunAbbas the easiest solution to workaround this issue until the relevant waiting Pull Request will be accepted, is to replace the react-native-gifted-chat dependency with the fork of @StagasaurusRex.
Just remove the module from your project and run yarn add https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet

Based on StagasaurusRex@58ae0c8, I forced using the new version of action sheet lib which fixes the issue.

1. Add this to the top level of the `package.json`
  "resolutions": {
    "@expo/react-native-action-sheet": "^3.6.0"
  }
1. run `yarn` again

2. The error should be gone ~

Yeah. it's work for me. Thank you

@imAunAbbas the easiest solution to workaround this issue until the relevant waiting Pull Request will be accepted, is to replace the react-native-gifted-chat dependency with the fork of @StagasaurusRex.
Just remove the module from your project and run yarn add https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet

@yogeverez I've just tried this but its showing the same error. May be it is just because I'm using NPM insted of Yarn as I'm working on Windows OS and Yarn is not suitable for Windows. I've tried all available solutions even changed the react-native-action-sheet version in both node module's package.json file and as well as in my project's package-lock.json. Nothing worked

@yogeverez I've just tried this but its showing the same error. May be it is just because I'm using NPM insted of Yarn as I'm working on Windows OS and Yarn is not suitable for Windows. I've tried all available solutions even changed the react-native-action-sheet version in both node module's package.json file and as well as in my project's package-lock.json. Nothing worked

@imAunAbbas, I don't think it is related to 'Yarn' or OS. did you try to delete your package-lock.json file and node_modules folder before running npm install?
Also, replace the react-native-gifted-chat dependency in you project package.json file with "react-native-gifted-chat": "https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet".
Then, try running npm install again

@yogeverez I've just tried this but its showing the same error. May be it is just because I'm using NPM insted of Yarn as I'm working on Windows OS and Yarn is not suitable for Windows. I've tried all available solutions even changed the react-native-action-sheet version in both node module's package.json file and as well as in my project's package-lock.json. Nothing worked

@imAunAbbas, I don't think it is related to 'Yarn' or OS. did you try to delete your package-lock.json file and node_modules folder before running npm install?
Also, replace the react-native-gifted-chat dependency in you project package.json file with "react-native-gifted-chat": "https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet".
Then, try running npm install again

@yogeverez thanks for your help. It is working now 馃槉

@FaridSafi mind updating the package

If you are using npm instead of yarn as your package manager, You need run npx npm-force-resolutions and then run npm install. Also, add it as a preinstall script.

 "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "preinstall": "npx npm-force-resolutions"
  },
  "resolutions": {
    "@expo/react-native-action-sheet": "3.6.0"
  },

+1

+1

thanks for this fix, but the packages is not updated in npmjs :/ @xcarpentier

@binwilly sorry, soon... (will try tomorrow)

The package is updated now 馃帀

I am still facing the same issue.

I'm also facing the same issue although the library is updated.

With the library is everything ok. Cache was making problems in my case.

Make sure:
1.) You remove node_modulesdirectory
2.) npm cache clean --force
3.) Deletepackage-lock.json and yarn-lock.json
4.) npm install
5.) If you are using expo run expo with command: expo r -c

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arayaryoma picture arayaryoma  路  3Comments

luisfuertes picture luisfuertes  路  3Comments

emilkarl picture emilkarl  路  3Comments

yogiben picture yogiben  路  3Comments

redwind picture redwind  路  3Comments