Skip to content

Missing peerDependency on React #740

@wojtekmaj

Description

@wojtekmaj

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:
  react-native-modal-datetime-picker@17.0.0:
    peerDependencies:
      react: '>=17.0.0'

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

Activity

added a commit that references this issue on Apr 19, 2024
a5808f0
linked a pull request that will close this issue on Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @wojtekmaj

      Issue actions

        Missing peerDependency on React · Issue #740 · mmazzarolo/react-native-modal-datetime-picker