react-native-vector-icons: type 'typeof Icon' is not a valid JSX element type
- Review the documentation: https://github.com/oblador/react-native-vector-icons
- Search for existing issues (including closed issues): https://github.com/oblador/react-native-vector-icons/issues
Environment
This issue happens in code.
here’s an screenshot:
Description
After upgrading RN to version 0.72.5 this issue happened.
here’s my package.json:
{
...
"dependencies": {
"react": "18.2.0",
"react-native": "0.72.5",
"react-native-svg": "^13.14.0",
"react-native-vector-icons": "^10.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.0",
"@babel/preset-env": "^7.22.20",
"@babel/runtime": "^7.23.1",
"@react-native-community/eslint-config": "^3.2.0",
"@react-native/metro-config": "^0.73.1",
"@tsconfig/react-native": "^3.0.2",
"@types/jest": "^29.5.5",
"@types/react-test-renderer": "^18.0.3",
"babel-jest": "^29.7.0",
"babel-plugin-module-resolver": "^5.0.0",
"eslint": "^8.50.0",
"eslint-plugin-unused-imports": "^3.0.0",
"jest": "^29.7.0",
"metro-react-native-babel-preset": "^0.77.0",
"prettier": "^3.0.3",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.2.0",
"typescript": "^5.2.2",
"@types/react": "^18.2.28",
"@types/react-native": "^0.72.3",
"@types/react-native-vector-icons": "^6.4.15"
},
...
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 15 (1 by maintainers)
In my case
yarnalready executesyarn dedupeautomatically so that didn’t solve the problem.What solved the problem for me was forcing the resolution in my
package.jsonlike so:The only workaround I found was to do this: Replace this
With this
This works like a charm ✨❤️
I tried to remove node_module, yarn.lock. then update “@types/react”: “18.2.39”, “@types/react-native”: “^0.72.7” and it work
I also have the same type error.
I fixed it with:
This is a mismatch between various
@types/reactversions installed by various packages.I’m using yarn 3 and I was able to fix it by running
yarn dedupe