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

Error preventing new pull requests: Cannot find module 'react-native-gesture-handler' or its corresponding type declarations. #11

Open
jordan-vdi opened this issue Feb 5, 2024 · 5 comments · May be fixed by #12

Comments

@jordan-vdi
Copy link

jordan-vdi commented Feb 5, 2024

I am trying to get this project running locally so I can attempt some pull requests, but I am running into a consistent typescript error after installing.

After installing and running yarn typecheck I receive these errors.

src/index.tsx:7:8 - error TS2307: Cannot find module 'react-native-gesture-handler' or its corresponding type declarations.

7 } from 'react-native-gesture-handler';
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/index.tsx:14:8 - error TS2307: Cannot find module 'react-native-gesture-handler' or its corresponding type declarations.

14 } from 'react-native-gesture-handler';
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/index.tsx:21:8 - error TS2307: Cannot find module 'react-native-reanimated' or its corresponding type declarations.

21 } from 'react-native-reanimated';
          ~~~~~~~~~~~~~~~~~~~~~~~~~

src/math.ts:1:42 - error TS2307: Cannot find module 'react-native-reanimated' or its corresponding type declarations.

1 import Animated, { useSharedValue } from 'react-native-reanimated';
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~


Found 4 errors in 2 files.

Errors  Files
     3  src/index.tsx:7
     1  src/math.ts:1

I'll continue to investigate, I figured it was worth mentioning here for visibility.

@jordan-vdi
Copy link
Author

I found this comment while digging through some issues on the yarn repo.

yarnpkg/yarn#5347 (comment)

It seems this is a common practice. The recommendation would be to switch the two dependencies from peer dependencies to actual dependencies. This would ensure that these dependencies are installed when running yarn.

I made the in my local project and the errors went away.

I'm curious if you were doing anything else to deal with these errors.

@jordan-vdi jordan-vdi linked a pull request Feb 5, 2024 that will close this issue
@fakeheal
Copy link
Owner

fakeheal commented Feb 6, 2024

I've added them as peerDependencies, because both react-native-reanimated and react-native-gesture-handler require additional setup for them to work properly on all platforms.

In the README of this repository I've mentioned that before installing react-native-pan-pinch-view you need to have those two packages installed & setup. I've also specified versions of said packages, because they tend to introduce breaking changes freqently.

@jordan-vdi
Copy link
Author

@fakeheal Yup, and that works in the project that I am using this in. I see that the peerDependencies should stay.

The issue that I am running into is when I tried to add the feature mentioned in #10. In a development context the two dependencies need to be present in order to pass the yarn typecheck which is a contribution requirement.

@jordan-vdi
Copy link
Author

It looks like you accounted for this by using install-peers, but that didn't work for me. It might be related to this. alexindigo/install-peers#8

@fakeheal
Copy link
Owner

Oh, I see, sorry I kind of misunderstood your first comment.

I will have to delve deeper into the install-peers and how to handle peerDependencies in npm packages with demos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants