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

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. #2749

Closed
LayMui opened this issue Feb 7, 2024 · 55 comments
Labels
Platform: MacOS Repro provided A reproduction with a snack or repo is provided

Comments

@LayMui
Copy link

LayMui commented Feb 7, 2024

Description

<GestureHandlerRootView cause error when running unit test with jest

Steps to reproduce

yarn to install all dependencies

run
yarn test -u

throw out these error
FAIL my-design-system-react-native libs/ahua-design-system-react-native/src/tests/BottomSheet.test.js
● Test suite failed to run

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","DeviceInfo","KeyboardObserver","I18nManager"],"TurboModules":[],"NotFound":["NativeAnimatedModule","SoundManager","FrameRateLogger","RNGestureHandlerModule"]}

  1 | import React, { forwardRef } from 'react';
  2 | import { Dimensions } from 'react-native';
> 3 | import { Modalize, ModalizeProps } from 'react-native-modalize';

this was ok with RN 0.72.3 and
"react-native-gesture-handler": "^2.9.0",

Snack or a link to a repository

https://github.com/LayMui/ahuaAppTesting

Gesture Handler version

2.15.0

React Native version

0.73.2

Platforms

MacOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

None

Device model

NA

Acknowledgements

Yes

@github-actions github-actions bot added Platform: MacOS Repro provided A reproduction with a snack or repo is provided Missing repro and removed Repro provided A reproduction with a snack or repo is provided labels Feb 7, 2024
@IvanRuch
Copy link

IvanRuch commented Feb 9, 2024

I had the same problem

cd ios
pod install
cd ..

solved the problem for me

@LayMui
Copy link
Author

LayMui commented Feb 10, 2024

@IvanRuch what is your RN version? if it's 0.72.3 it will work for me but not 0.73.2

@LayMui
Copy link
Author

LayMui commented Feb 10, 2024

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

unable to show the private repo as it's quite huge
but i have provided the code snippet as above. just wonder if this react-native-gesture-handler 2.15.0 is compatible with the new latest RN version 0.73.2?

@LayMui
Copy link
Author

LayMui commented Feb 11, 2024

the complete error is
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","DeviceInfo","KeyboardObserver","I18nManager"],"TurboModules":[],"NotFound":["NativeAnimatedModule","SoundManager","FrameRateLogger","RNGestureHandlerModule"]}

@github-actions github-actions bot added Repro provided A reproduction with a snack or repo is provided and removed Missing repro labels Feb 11, 2024
@LayMui
Copy link
Author

LayMui commented Feb 11, 2024

hi, I have provided the minimal repo at https://github.com/LayMui/ahuaAppTesting

please take a look
this is an issue when running
yarn test -u
or yarn test

@LayMui
Copy link
Author

LayMui commented Feb 11, 2024

could this be due to this PR not merged? #2724

@RafaPatino01
Copy link

I'm having the same issue here

*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.', reason: 'Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registere..., stack:

@NguyenQuocAnDev27
Copy link

NguyenQuocAnDev27 commented Feb 15, 2024

I'm having the same issue here. It happed after i installed @react-navigation/drawer, cmd: "npm install @react-navigation/drawer", my react native version is 0.73

@denlahodnyi
Copy link

I had the same issue when running my tests. This solution (link) from React Navigation docs helped me to resolve it.

setup-jest.js

import 'react-native-gesture-handler/jestSetup';

jest.config.js

{
  "setupFiles": [
    "<rootDir>/setup-jest.js"
  ],
}

@mikey18
Copy link

mikey18 commented Feb 21, 2024

i have a very similar issue too

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","SourceCode","Timing","AppState","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","Networking","Appearance","DevLoadingView","HeadlessJsTaskSupport","DeviceInfo","UIManager","DeviceEventManager","RNCSafeAreaContext","NativeAnimatedModule","SoundManager","I18nManager","StatusBarManager","StatusBarManager","ImageLoader"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","FrameRateLogger","KeyboardObserver","RNGestureHandlerModule"]}, js engine: hermes

ERROR Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it, and restart it in the current project.
  • A module failed to load due to an error, and AppRegistry.registerComponent wasn't called., js engine: hermes

I am using expo development Build; i have rebuilt the app so many times, cleared my cache, and nothing works

im using a windows PC. Please, has anyone faced this issue and gotten a fix?, i've been trying to debug this thig for a week now, and i'm seriously getting tired of React Native at this point, more of debugging than actual productivity.

@Mary-Grigoryan
Copy link

I am having the same issue too. Tried to use react native gesture handler version < 2.15.0 and still didn't work. I have ran pod install too. I'm also on RN version 0.73.4.

@mikey18

This comment was marked as outdated.

@Mary-Grigoryan
Copy link

Thank you, just did that and the error went away

@mikey18
Copy link

mikey18 commented Feb 25, 2024

very happy to hear that👌

@LayMui
Copy link
Author

LayMui commented Feb 27, 2024

mikey18 what version of react-native-gesture-handler are you using? 2.13.4
it still give that error
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":[],"TurboModules":[],"NotFound":["RNGestureHandlerModule"]}

this is an issue of react-native-gesture-handler with jest rather than the latest RN version, right?

@mikey18
Copy link

mikey18 commented Feb 27, 2024

Hey LayMui, I'm not sure if the issue is rather with Jest or the RN version itself, but I was using react-native-gesture-handler 2.15.0, which was causing the error, then I downgraded to react-native-gesture-handler 2.14.0, and it stopped showing the error, and I'm using the latest RN.

@LayMui
Copy link
Author

LayMui commented Feb 27, 2024

it still fail
FAIL src/tests/BottomSheet.test.js
● Test suite failed to run

       Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":[],"TurboModules":[],"NotFound":["RNGestureHandlerModule"]}
   
         1 | import 'react-native';
       > 2 | import 'react-native-gesture-handler';
           | ^
         3 | import renderer, { act } from 'react-test-renderer';
         4 | import { AhuaText } from '../lib/AhuaText';
         5 | import { BottomSheet } from '../lib/BottomSheet';

@LayMui
Copy link
Author

LayMui commented Feb 27, 2024

here is my package.json

"dependencies": {
"react-native-pager-view": "^6.1.2",
"react-native-gesture-handler": "^2.14.0",

@mikey18
Copy link

mikey18 commented Feb 27, 2024

try using 'npx expo-doctor' to see what is causing the conflicts

@LayMui
Copy link
Author

LayMui commented Feb 28, 2024

my project don't use expo.
is there any other command I can use?
I used 2.14.0 or 2.15.0 I saw the same error
once I have this line
import 'react-native-gesture-handler';

@denlahodnyi
Copy link

@LayMui Have you tried my solution? Or the same one, but from the gesture-handler docs. I should have mocked gesture-handler to run my tests. Maybe it'll help you too.

@LayMui
Copy link
Author

LayMui commented Feb 28, 2024

my file is test-setup.js
I add the line import 'react-native-gesture-handler/jestSetup';

import '@testing-library/jest-native/extend-expect';
import 'react-native-gesture-handler/jestSetup';

here is the jest.config.ts
module.exports = {
displayName: 'react-native-app',
preset: 'react-native',
resolver: '@nx/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
setupFilesAfterEnv: ['/test-setup.ts'],
moduleNameMapper: {
'\.svg$': '@nx/react-native/plugins/jest/svg-mock',
},
coverageDirectory: '../../coverage/apps/react-native-app',
};

but still the same error

at Object.require (src/tests/BottomSheet.test.js:2:1)

PASS react-native-app apps/react-native-app/src/app/App.spec.tsx (23.393 s)
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.

Summary of all failing tests
FAIL libs/ahua-design-system-react-native/src/tests/BottomSheet.test.js
● Test suite failed to run

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":[],"TurboModules":[],"NotFound":["RNGestureHandlerModule"]}

  1 | import 'react-native';
> 2 | import 'react-native-gesture-handler';
    | ^
  3 | import renderer, { act } from 'react-test-renderer';
  4 | import { AhuaText } from '../lib/AhuaText';
  5 | import { BottomSheet } from '../lib/BottomSheet';

  at invariant (../../node_modules/invariant/invariant.js:40:15)
  at Object.getEnforcing (../../node_modules/react-native/Libraries/TurboModule/TurboModuleRegistry.js:87:12)
  at Object.getEnforcing (../../node_modules/react-native-gesture-handler/lib/commonjs/specs/NativeRNGestureHandlerModule.ts:26:36)
  at Object.<anonymous> (../../node_modules/react-native-gesture-handler/lib/commonjs/RNGestureHandlerModule.ts:4:1)
  at Object.<anonymous> (../../node_modules/react-native-gesture-handler/lib/commonjs/init.ts:2:1)
  at Object.<anonymous> (../../node_modules/react-native-gesture-handler/lib/commonjs/index.ts:1:1)
  at Object.require (src/tests/BottomSheet.test.js:2:1)

@LayMui
Copy link
Author

LayMui commented Feb 28, 2024

I use
"react-native-gesture-handler": "2.9.0",

plus add the import 'react-native-gesture-handler/jestSetup'; to test.setup.ts
still having this error

       Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":[],"TurboModules":[],"NotFound":["RNGestureHandlerModule"]}

@Princejain21
Copy link

@mikey18 have you resolve this error?

i have a very similar issue too

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","SourceCode","Timing","AppState","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","Networking","Appearance","DevLoadingView","HeadlessJsTaskSupport","DeviceInfo","UIManager","DeviceEventManager","RNCSafeAreaContext","NativeAnimatedModule","SoundManager","I18nManager","StatusBarManager","StatusBarManager","ImageLoader"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","FrameRateLogger","KeyboardObserver","RNGestureHandlerModule"]}, js engine: hermes

ERROR Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it, and restart it in the current project.
  • A module failed to load due to an error, and AppRegistry.registerComponent wasn't called., js engine: hermes

I am using expo development Build; i have rebuilt the app so many times, cleared my cache, and nothing works

im using a windows PC. Please, has anyone faced this issue and gotten a fix?, i've been trying to debug this thig for a week now, and i'm seriously getting tired of React Native at this point, more of debugging than actual productivity.

please guide me to be resolve this?

@PhamQuyet1606
Copy link

Thanks @LayMui, but my issue is when the app running on the device, and I haven't run unit test yet

@mckenzieja
Copy link

installing

@mikey18 have you resolve this error?

i have a very similar issue too
ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","SourceCode","Timing","AppState","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","Networking","Appearance","DevLoadingView","HeadlessJsTaskSupport","DeviceInfo","UIManager","DeviceEventManager","RNCSafeAreaContext","NativeAnimatedModule","SoundManager","I18nManager","StatusBarManager","StatusBarManager","ImageLoader"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","FrameRateLogger","KeyboardObserver","RNGestureHandlerModule"]}, js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it, and restart it in the current project.
  • A module failed to load due to an error, and AppRegistry.registerComponent wasn't called., js engine: hermes

I am using expo development Build; i have rebuilt the app so many times, cleared my cache, and nothing works
im using a windows PC. Please, has anyone faced this issue and gotten a fix?, i've been trying to debug this thig for a week now, and i'm seriously getting tired of React Native at this point, more of debugging than actual productivity.

please guide me to be resolve this?

use npm i react-native-gesture-handler
Fixed it for me.

@inayatAliDev
Copy link

I had the same issue when running my tests. This solution (link) from React Navigation docs helped me to resolve it.

setup-jest.js

import 'react-native-gesture-handler/jestSetup';

jest.config.js

{
  "setupFiles": [
    "<rootDir>/setup-jest.js"
  ],
}

import 'react-native-gesture-handler/jestSetup';

By adding above line solved issue for me
Thanks dud

@Arnoldayapana
Copy link

also facing the same issue, can someone help me?
TurboModule Registry.getEnforcing(...):
'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary. Bridgeless mode: false. TurboModule interop: false. Modules loaded: ("NativeModules":["PlatformConstants","Log Box", "SourceCode","Timing","AppState","Blob Module","WebSo cketModule","DevSettings","Dev Tools Settings Manager","Netw orking","Appearance","DevLoadingView","HeadlessJsTaskSup port","DeviceInfo","UIManager","ImageLoader","SoundManag er","IntentAndroid","Device EventManager","NativeAnimatedM odule","RNCSafeAreaContext","118nManager"],"TurboModules": [],"NotFound":["NativePerformanceCxx","Native PerformanceOb serverCxx","RedBox","Bug Reporting","Linking Manager","NativeR eactNative FeatureFlagsCxx","RNGestureHandlerModule"]}

@snenenenenenene
Copy link

For me simply rerunning: npm i react-native-gesture-handler worked!

@Ratna99
Copy link

Ratna99 commented Jun 27, 2024

For me, I had nx mono repo. And I have installed react-native-gesture-handler in my main package.json file (I was not using it directly but other package:react-navigation was using it). So, react-native-gesture-handler was missing in package.json of my mobile app directory. So, I added "react-native-gesture-handler": "*" in package.json inside my mobile directory, pod install in ios and then did a build run-ios. Then finally it worked.

@nagasridhar19
Copy link

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","Timing","AppState","SourceCode","BlobModule","WebSocketModule","SettingsManager","DevSettings","RedBox","Networking","Appearance","DevLoadingView","UIManager","DeviceInfo","ImageLoader","LinkingManager"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","BugReporting","HeadlessJsTaskSupport","SoundManager","IntentAndroid","RNGestureHandlerModule"]}, js engine: hermes
LOG Running "Nebula" with {"rootTag":1,"initialProps":{"concurrentRoot":false}}
ERROR Invariant Violation: "Nebula" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes

Getting this error how to resolve this ??

@canozcano
Copy link

Hello, I get this warning when I want to run my code with npm start on my Windows 10 operating system. Additionally, I run it on my iOS phone via the Expogo mobile application, but I don't think this is the reason for the error. Can anyone help?

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGoogleSignin' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","SourceCode","Timing","AppState","BlobModule","WebSocketModule","SettingsManager","DevSettings","Networking","RedBox","Appearance","DevLoadingView","DeviceInfo","UIManager","ImageLoader","LinkingManager","AsyncLocalStorage"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","BugReporting","HeadlessJsTaskSupport","SoundManager","IntentAndroid","PlatformLocalStorage","RNC_AsyncSQLiteDBStorage","RNCAsyncStorage","AsyncSQLiteDBStorage","RNGoogleSignin"]}, js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes

@j-piasecki
Copy link
Member

What is the version of React Native that you're using?

@nagasridhar19
Copy link

nagasridhar19 commented Jul 9, 2024 via email

@Anusha-mathur
Copy link

Anusha-mathur commented Jul 15, 2024

facing same issue, any idea how to resolve?

"react-native-gesture-handler": "~2.17.1",

jest.config.js

 module.exports = {
    preset: 'react-native',
    setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
};

Bridgeless mode is enabled
(NOBRIDGE) ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: true. TurboModule interop: true. Modules loaded: {"NativeModules":[],"TurboModules":["PlatformConstants","LogBox","SourceCode","AppState","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","Networking","Appearance","DevLoadingView","DeviceInfo","ImageLoader","SoundManager","IntentAndroid","DeviceEventManager","NativeAnimatedModule","I18nManager"],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","HeadlessJsTaskSupport","LinkingManager","NativeReactNativeFeatureFlagsCxx","RNCSafeAreaContext","ReanimatedModule","RNGestureHandlerModule"]}
(NOBRIDGE) LOG Running "trendlyne_app" with {"rootTag":11,"initialProps":{},"fabric":true}
(NOBRIDGE) ERROR Invariant Violation: "trendlyne_app" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

@nagasridhar19
Copy link

nagasridhar19 commented Jul 15, 2024 via email

@nagasridhar19
Copy link

nagasridhar19 commented Jul 15, 2024 via email

@Rohith1Q
Copy link

hello facing this issue can some help me out

07-25 14:53:19.604 20405 20445 E ReactNativeJS: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["HeadlessJsTaskSupport","PlatformConstants","SourceCode","DeviceInfo","UIManager","DeviceEventManager","RNCSafeAreaContext","NativeAnimatedModule","SoundManager","I18nManager","ImageLoader","Timing","BlobModule","Networking","RNCAsyncStorage","ReanimatedModule"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","NativeReactNativeFeatureFlagsCxx","RNSModule","PlatformLocalStorage","RNC_AsyncSQLiteDBStorage","FrameRateLogger","KeyboardObserver","RNGestureHandlerModule"]}, js engine: hermes
07-25 14:53:19.607 20405 20445 I ReactNativeJS: Running "main
07-25 14:53:19.608 20405 20445 E ReactNativeJS: Invariant Violation: "main" has not been registered. This can happen if:
07-25 14:53:19.608 20405 20445 E ReactNativeJS: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
07-25 14:53:19.608 20405 20445 E ReactNativeJS: * A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes

@Olekssi56
Copy link

yes. my colleague has fixed it add this line

  setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
};

to

module.exports = {
  displayName: 'xxx-system-react-native',
  preset: 'react-native',
  resolver: '@nx/jest/plugins/resolver',
  moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
  setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
  moduleNameMapper: {
    // '.svg': '@nx/react-native/plugins/jest/svg-mock',
  },
  transformIgnorePatterns: [
  'node_modules/(?!(@react-native|react-native|react-native-calendars|react-native-swipe-gestures)/)',
  ],
  setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
};

to the file jest.config.ts

Hey, @LayMui
So what version of gesture-handler do you use to solve it?
What react-native-version?

@darkmoor24
Copy link

yes. my colleague has fixed it add this line

  setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
};

to

module.exports = {
  displayName: 'xxx-system-react-native',
  preset: 'react-native',
  resolver: '@nx/jest/plugins/resolver',
  moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
  setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
  moduleNameMapper: {
    // '.svg': '@nx/react-native/plugins/jest/svg-mock',
  },
  transformIgnorePatterns: [
  'node_modules/(?!(@react-native|react-native|react-native-calendars|react-native-swipe-gestures)/)',
  ],
  setupFiles: ["../../node_modules/react-native-gesture-handler/jestSetup.js"],
};

to the file jest.config.ts

this worked for me with React Native 0.75.2 and react-native-gesture-handler 2.16.2

@jahau
Copy link

jahau commented Oct 16, 2024

Add this to your package.json.

  "jest": {
    "setupFiles": [
      "<rootDir>/node_modules/react-native-gesture-handler/jestSetup.js"
    ],

@petertoth-dev
Copy link

@jahau didn't work with react-native 0.75.4

@MobileMon
Copy link

for me the solution was to

cd ios

pod install

@SSL-ACTX
Copy link

I solved it!

by using these versions instead of recommended ones. 😭
{ "name": "", "version": "1.0.0", "main": "expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "@expo/vector-icons": "^14.0.4", "@react-native-community/masked-view": "^0.1.11", "@react-navigation/bottom-tabs": "^6.6.1", "@react-navigation/native": "^6.1.18", "@react-navigation/stack": "^6.4.1", "expo": "~51.0.28", "expo-auth-session": "~5.5.2", "expo-blur": "~13.0.2", "expo-font": "^12.0.10", "expo-status-bar": "~1.12.1", "react": "18.2.0", "react-native": "0.74.5", "react-native-gesture-handler": "^2.20.0", "react-native-safe-area-context": "^4.11.1", "react-native-screens": "^3.34.0", "react-native-snap-carousel": "^3.9.1", "react-native-svg": "^15.8.0", "expo-av": "~14.0.7" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true }

@umutturkeri
Copy link

i had same issues, its giving me same error log my gesture-handler 2.21.2 react-native 0.75.3
pls help me

@EmadAldardoor
Copy link

i had same issues, its giving me same error log my gesture-handler 2.21.2 react-native 0.75.3 pls help me

same issue in react-native:0.76.4, did u find the solution ?

@Artem0302
Copy link

same issue with "react-native": "0.76.4" and "react-native-gesture-handler": "^2.21.2"

@Artem0302
Copy link

Update: fixed by upgrading react native to 76.5

@Nicolas-Saade
Copy link

This is what worked for me with react native 76.5:

rm -rf node_modules
rm yarn.lock package-lock.json
npm install
cd ios
pod install
cd ..

npm install react-native-gesture-handler@latest

npm start --reset-cache
cd ios
xcodebuild clean
pod install
cd ..
npx react-native run-ios

It seems like the issue is related to some bad auto-linking with gesture handler module for some reason, really a shame that the manual link command has been removed in newer versions of react-native and we are not allowed to use manual linking (as far as I know), especially that the auto link never works as it should for me, would love to have this issue fixed.

@vyestuary
Copy link

vyestuary commented Jan 13, 2025

  • Upgrade node to 18
  • rm -rf node_modules
  • yarn install
  • uninstall app and rebuild work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: MacOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

No branches or pull requests