react-native-gifted-chat: Latest React Native 0.62.0: Type Errror: Super expression must either be null or a function
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
- Upgrade RN to 0.62.0.
import { GiftedChat } from 'react-native-gifted-chat';
- 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
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 21
- Comments: 34 (1 by maintainers)
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.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.
package.json
run
yarn
againThe error should be gone ~
The package is updated now 🎉
Admin, Please update the expo/react-native-action-sheet/issues package to 3.6.0 in the gifted chat
With the library is everything ok. Cache was making problems in my case.
Make sure: 1.) You remove
node_modules
directory 2.)npm cache clean --force
3.) Deletepackage-lock.json
andyarn-lock.json
4.)npm install
5.) If you are using expo run expo with command:expo r -c
@imAunAbbas, I don’t think it is related to ‘Yarn’ or OS. did you try to delete your
package-lock.json
file andnode_modules
folder before runningnpm install
? Also, replace thereact-native-gifted-chat
dependency in you projectpackage.json
file with"react-native-gifted-chat": "https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet"
. Then, try runningnpm install
againYeah. it’s work for me. Thank you
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.
@FaridSafi mind updating the package
@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
My fork bypasses the build process and isn’t appropriate to merge. PR #1712 would be better.