-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Svg' cannot be used as a JSX component #1741
Comments
This works fine in the TypeScript Playground. Does this error also occur when running |
Hey, that's VSCode, type checking the project. It's a private repo, tomorrow I can give it another try and provide a repo if the issue persists.
package.json
New and slightly different error |
@caiorrsdeg try, resolved my problem facebook/react#24304 (comment) |
Reproduceable sample project https://github.com/caiorrs/react-types-error |
thanks man, it worked, did not saw it before |
If you're seeing "SomeComponent cannot be used as a JSX component." after installing React 18 types make sure to only have a single version of The issue is not caused by a specific version of |
@eps1lon Thanks so much for this. |
See https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html Also software-mansion/react-native-svg#1741 (comment) related to conflicted versions of @types/react
See https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html Also software-mansion/react-native-svg#1741 (comment) related to conflicted versions of @types/react
Thanks my friend!!!! |
Multiple type versions lead to type errors like this one https://github.com/software-mansion/react-native-svg/issues/1741\#issuecomment-1093812197
* Update for docusaurus v3 versions * Fix non-terminating image, I think this is the intended one * Fixing prism post-upgrade - Requires more languages to be listed, not automatically included now - Markup-templating required by ejs, must specify explicitly or build breaks - Update some language references in code blocks that aren't actually supported by prism * Fix observer crash when navigating from homepage * Update last plugin and clsx * Actual fix for useIntersection * Force a single resolution of react types Multiple type versions lead to type errors like this one https://github.com/software-mansion/react-native-svg/issues/1741\#issuecomment-1093812197 * Leave comment that gtag is not meant to work in dev * Convert config to real typescript * Re-swizzle DocItem/Footer as TS and add more fixes * Type fixes and disallow unchecked indexed access * Fix snippet typing issue with home page top bar * Add a note about swizzling * Don't emit on typecheck
* Update for docusaurus v3 versions * Fix non-terminating image, I think this is the intended one * Fixing prism post-upgrade - Requires more languages to be listed, not automatically included now - Markup-templating required by ejs, must specify explicitly or build breaks - Update some language references in code blocks that aren't actually supported by prism * Fix observer crash when navigating from homepage * Update last plugin and clsx * Actual fix for useIntersection * Force a single resolution of react types Multiple type versions lead to type errors like this one https://github.com/software-mansion/react-native-svg/issues/1741\#issuecomment-1093812197 * Leave comment that gtag is not meant to work in dev * Convert config to real typescript * Re-swizzle DocItem/Footer as TS and add more fixes * Type fixes and disallow unchecked indexed access * Fix snippet typing issue with home page top bar * Add a note about swizzling * Don't emit on typecheck
* Update for docusaurus v3 versions * Fix non-terminating image, I think this is the intended one * Fixing prism post-upgrade - Requires more languages to be listed, not automatically included now - Markup-templating required by ejs, must specify explicitly or build breaks - Update some language references in code blocks that aren't actually supported by prism * Fix observer crash when navigating from homepage * Update last plugin and clsx * Actual fix for useIntersection * Force a single resolution of react types Multiple type versions lead to type errors like this one https://github.com/software-mansion/react-native-svg/issues/1741\#issuecomment-1093812197 * Leave comment that gtag is not meant to work in dev * Convert config to real typescript * Re-swizzle DocItem/Footer as TS and add more fixes * Type fixes and disallow unchecked indexed access * Fix snippet typing issue with home page top bar * Add a note about swizzling * Don't emit on typecheck
*First bug open here, sorry if not doing it right
Bug
When using an SVG converted with SVGR Typescript raises an error about '...' cannot be used as a JSX component, where ... is a component from react-native-svg
for example:
tested on 12.1.0 (what we are using) and 12.3.0 (latest) with expo 44
The project uses a builder bob made package
example project inside the package
Unexpected behavior
The example expo app is not able to run due to the typescript issue
Environment info
Run
react-native info
in your terminal and copy the results here. Also, include the precise version number of this library that you are using in the projectReact native info output:
Library version: 12.1.0
Steps To Reproduce
create a react native builder bob package with expo (JS/TS only)
grab a svg from web and use SVGR to create a react native component
copy the output from SVGR playground to a new component on the example app
the TS error should be displayed
Describe what you expected to happen:
The text was updated successfully, but these errors were encountered: