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

'ReactNativeKCKeepAwake' could not be found. Verify that a module by this name is registered in the native binary. #11

Open
raduvarga opened this issue Jan 23, 2024 · 5 comments

Comments

@raduvarga
Copy link

raduvarga commented Jan 23, 2024

I am getting the above error after installing the library.
On iOS, I figured I have to install the pods and then the error went away.
Are there further Android installation instructions?

@aybarska
Copy link

aybarska commented Feb 5, 2024

Same here. Cant run on android.

@sayem314
Copy link
Owner

We have a app running with older builds, I haven't touched react-native in a while so I cannot debug this atm.

@SpaceTimeEvent
Copy link

Same on iOS latest RN

@owlfrancesco
Copy link

I am getting a similar error, but only when running tests with jest:

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

Version 1.2.3

Any ideas?

@rebeccachin
Copy link

rebeccachin commented Mar 18, 2024

Hey @owlfrancesco, I also encounter the same.

I solved it by adding a mock for TurboModuleRegistry.getEnforcing(...), as per this stackoverflow thread

jest.mock('react-native/Libraries/TurboModule/TurboModuleRegistry', () => {
  const turboModuleRegistry = jest.requireActual('react-native/Libraries/TurboModule/TurboModuleRegistry');
  return {
    ...turboModuleRegistry,
    getEnforcing: (name) => {
      // List of TurboModules libraries to mock.
      const modulesToMock = ['ReactNativeKCKeepAwake'];
      if (modulesToMock.includes(name)) {
        return null;
      }
      return turboModuleRegistry.getEnforcing(name);
    },
  };
});

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

5 participants