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

react-native-gesture-handler dependency resolution issues #758

Open
Thomas-Hopkins opened this issue Jul 9, 2024 · 0 comments
Open

react-native-gesture-handler dependency resolution issues #758

Thomas-Hopkins opened this issue Jul 9, 2024 · 0 comments

Comments

@Thomas-Hopkins
Copy link

Thomas-Hopkins commented Jul 9, 2024

I realize this library is not maintained and mostly abandoned. So I am mostly posting this as a guide to help out anyone else who may be encountering the same issues and cannot easily migrate away from this library. I am utilizing the Expo ecosystem so things may be different for you if not utilizing that.

I am using [email protected] because of the issues outlined in #647 . This introduced react-native-gesture-handler as a dependency, we also had this as a direct dependency already. This was working fine as of Expo SDK 49. We recently had to upgrade Expo to SDK 51, and started encountering the following issue on upgrade to SDK 50, on both development builds and running via Expo Go.

Tried to register two views with the same name RNGestureHandlerButton

We were able to resolve this on development builds and Expo Go by removing our app's direct dependency on react-native-gesture-handler. However, upon executing a full build we encountered the following:

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.

This very well may be an Expo issue, of it not properly building with library dependencies. However, the solution for us was to create a yarn patch for react-native-dropdown-picker to move react-native-gesture-handler to a peer dependency rather than a hard dependency. This allowed us to directly include react-native-gesture-handler as a dependency and run on development builds, Expo Go, and build full builds.

TL;DR:

yarn patch react-native-dropdown-picker

package.json

-  "dependencies": {
-    "react-native-gesture-handler": "*"
-  },
   "peerDependencies": {
+   "react-native-gesture-handler": "*",
     "react": "*",
     "react-native": "*"
   },

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

No branches or pull requests

1 participant