Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing peerDependency on React #740

Open
wojtekmaj opened this issue Apr 18, 2024 · 0 comments · May be fixed by #741
Open

Missing peerDependency on React #740

wojtekmaj opened this issue Apr 18, 2024 · 0 comments · May be fixed by #741
Labels

Comments

@wojtekmaj
Copy link

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 wojtekmaj added the bug label Apr 18, 2024
wojtekmaj added a commit to wojtekmaj/react-native-modal-datetime-picker that referenced this issue Apr 19, 2024
@wojtekmaj wojtekmaj linked a pull request Apr 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant