Doko-Demo-Doa / react-native-shake

React Native shake event detector
MIT License
261 stars 64 forks source link

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNShake' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes #53

Open rzoro opened 1 year ago

rzoro commented 1 year ago

Getting this error after upgrading to 5.5.0.

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
WayneKim92 commented 1 year ago

jest.config.js

setupFiles: [
  mockReactNativeShake.js
}

mockReactNativeShake.js

jest.mock('react-native-shake', () => ({
    addListener: jest.fn(),
    removeAllListeners: jest.fn(),
}));
asteriomanet commented 7 months ago

I'm encountering the same issue as @rzoro reported with RN version 0.72.1.

In addition, I tried to create a new/fresh project with the latest RN version 0.73.4, iOS version 17.3. Just to validate if my current app RN version is just the one having an issue.

Created an adhoc version of it for release mode and install in actual device. Result: The listener is not triggered at all.

I wonder if anyone got the same issue.

Doko-Demo-Doa commented 3 weeks ago

Published a new version (6.0.0-beta.2). Can you try?