react-native-modal-datetime-picker icon indicating copy to clipboard operation
react-native-modal-datetime-picker copied to clipboard

Missing peerDependency on React

Open wojtekmaj opened this issue 2 months ago • 0 comments

react-native-modal-datetime-picker fails to declare peerDependency on React (likely: >=17.0.0), which it imports in typings. Consequently, type checking react-native-modal-datetime-picker fails on Yarn in PnP mode (which is a bit more strict, not allowing packages access to other packages "by accident"):

Error: input_field/date_input.tsx(66,7): error TS2607: JSX element class does not support attributes because it does not have a 'props' property.
Error: input_field/date_input.tsx(66,[8]error TS2786: 'DateTimePicker' cannot be used as a JSX component.
  Its type 'typeof DateTimePicker' is not a valid JSX element type.
    Type 'typeof DateTimePicker' is not assignable to type 'new (props: any, deprecatedLegacyContext?: any) => Component<any, any, any>'.
      Type 'DateTimePicker' is missing the following properties from type 'Component<any, any, any>': context, setState, forceUpdate, render, and 3 more.

Adding the following to yarnrc.yml:

packageExtensions:
  [email protected]:
    peerDependencies:
      react: '>=17.0.0'

fixes the issue, which proves adding a peerDependency on react is all it takes to fix it.

wojtekmaj avatar Apr 18 '24 20:04 wojtekmaj