You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I've got an strange error happening to some components such as View and Avatar, they both are marked as not valid components and give me this:
'View' cannot be used as a JSX component.
Its instance type 'Component<ViewProps & { useCustomTheme?: boolean; }, any, any>' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'React.ReactNode' is not assignable to type 'import("/home/ivopr/finyances/node_modules/@types/react-native/node_modules/@types/react/index").ReactNode'.
Also note that everything keeps working the way it should be, just that annoying red line is coming up.
I've messed things a bit, and changing React.ComponentClass to JSX.Element in typings at components/{component}/index.d.ts on declare const _default solved this. Not sure if it is the right way to do things.
There is actually 3 components (to the time of this) that I've have this error popup: View, Avatar and Dialog
Tried changing VSCode TS version, but the error persisted.
Why did I try this? I saw another issue here that mentioned the reversion of some code that relied on TS 4.4, so I tried it with the TS installed by Expo, which is 4.3.5
After some more searching, I've found out that this is an error with react native pulling in @types/react at version 18, but expo projects still doesn't support it. The easiest way to fix it for now is to add a resolution to your package.json that says to use @types/react at version 17.
Linked the issue where it was solved
Description
Hey, I've got an strange error happening to some components such as
View
andAvatar
, they both are marked as not valid components and give me this:Also note that everything keeps working the way it should be, just that annoying red line is coming up.
Related to
Steps to reproduce
Expected behavior
To not give these red lines
Actual behavior
It's giving the red lines
More Info
Code snippet
There, the
View
andAvatar
components are signaling the things mentioned aboveScreenshots/Video
Environment
Affected platforms
The text was updated successfully, but these errors were encountered: