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-sheetor 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.jsonrun
yarnagainThe 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_modulesdirectory 2.)npm cache clean --force3.) Deletepackage-lock.jsonandyarn-lock.json4.)npm install5.) 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.jsonfile andnode_modulesfolder before runningnpm install? Also, replace thereact-native-gifted-chatdependency in you projectpackage.jsonfile with"react-native-gifted-chat": "https://github.com/StagasaurusRex/react-native-gifted-chat.git#upgrade-action-sheet". Then, try runningnpm installagainYeah. 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-sheetMy fork bypasses the build process and isn’t appropriate to merge. PR #1712 would be better.