React native material ripple typescript error when using children

78 views Asked by At

I have joined the project where react native material ripple is in use,

 "react-native-material-ripple": "^0.9.1",
 "@types/react-native-material-ripple": "^0.9.2",

And there are typescript errors all over the place saying that

 Overload 1 of 2, '(props: RippleProps | Readonly<RippleProps>): Ripple', gave the following error.
    Type '{ children: Element; onPress: () => void; style: { height: number; width: number; margin: number; borderRadius: number; overflow: "hidden"; alignItems: "center"; justifyContent: "center"; }; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Ripple> & Readonly<RippleProps>'.
      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Ripple> & Readonly<RippleProps>'.
  Overload 2 of 2, '(props: RippleProps, context: any): Ripple', gave the following error.
    Type '{ children: Element; onPress: () => void; style: { height: number; width: number; margin: number; borderRadius: number; overflow: "hidden"; alignItems: "center"; justifyContent: "center"; }; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Ripple> & Readonly<RippleProps>'.
      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Ripple> & Readonly<RippleProps>'.ts(2769)

I have checked the documentation and in the example, on GitHub it clearly says that is should contain children https://github.com/n4kz/react-native-material-ripple#usage

would you be able to tell me what can I do to get rid of these errors? It gives a very negative impression that there are errors in every file and a feeling of code being untidy. Thanks

0

There are 0 answers