Skip to content

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

@Thomas-Hopkins

Description

@Thomas-Hopkins

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 react-native-dropdown-picker@5.4.7-beta.1 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": "*"
   },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions