expo / vector-icons

https://icons.expo.fyi
MIT License
647 stars 114 forks source link

typescript error 'Ionicons' cannot be used as a JSX component. #225

Closed Kir93 closed 2 years ago

Kir93 commented 2 years ago

Error Message is 'Ionicons' cannot be used as a JSX component.

Its instance type 'Component<IconProps<"moon" | "body" | "code" | "link" | "map" | "menu" | "time" | "ellipse" | "filter" | "image" | "stop" | "text" | "search" | "repeat" | "at" | "key" | "alert" | "checkbox" | "document" | ... 3661 more ... | "md-woman-sharp">, {}, any>' is not a valid JSX element. The types returned by 'render()' are incompatible between these types. Type 'import("/Volumes/T7/toy/project/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'. Type '{}' is not assignable to type 'ReactNode'. ts(2786)

how can i fix this error? Any help would be appreciated.

lucasuracosta commented 2 years ago

Same issue for me. It started happening when I updated to expo SDK 45

miege2k commented 2 years ago

Same issue for me.

viniciusreiss commented 2 years ago

Same error here.

viniciusreiss commented 2 years ago

@miege2k @Lucas-Meowtel

I updated the react types and this error disappeared.

yarn add -D @types/react

Kir93 commented 2 years ago

@types/react: 18.0.14. type error fixed.