SrBrahma / react-native-shadow-2

Cross-platform shadow for React Native. Supports Android, iOS, Web, and Expo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript: missing children on ShadowProps

Czino opened this issue · comments

commented

I encountered the following error when using

  Property 'children' does not exist on type 'IntrinsicAttributes & ShadowProps'.ts(2322)

Even for the simplest code:

<Shadow>
      <TextInput/>
</Shadow>

I could only solve it by adding children?: ReactNode; to the ShadowProps

commented

This is strange.

The Shadow component is defined by export const Shadow: React.FC<ShadowProps> = ..., and React.FC automatically adds the children property to the component type. The ShadowProps type doesn't have it, but does the Shadow.

What version of react-native-shadow-2 and @types/react are you using?

commented

I can add the children?: React.ReactNode; to the ShadowProps (just saw that ViewProps for example has it), but I don't see how you are having this issue

I believe this issue is likely from the @types/react 18 upgrade:

https://solverfox.dev/writing/no-implicit-children/

commented

I believe this issue is likely from the @types/react 18 upgrade:

https://solverfox.dev/writing/no-implicit-children/

Thanks. Tomorrow I will release a hotfix.

commented

Hi! Just released 6.0.4 (ea9bfd2) fixing this issue.

Many thanks for the report, @Czino and @hcharley!