Solvedreact native geolocation service Invariant Violation: Native module cannot be null.

I have been using v4.0.0 without problems.
Updating to v5.0.0 is causing the error below on IOS.
Going back to v4.0.0 (no other changes) fixes the issue.

I just updated the version and ran yarn install & pod install.
The bridging header is in the project.
React-Native is at 0.62.2.

Are there any other steps we have to complete to upgrade?

Invariant Violation: Native module cannot be null.

invariant
    browser.js:38:14
constructor
    NativeEventEmitter.js:37:6
<global>
    Geolocation.native.js:3:28
loadModuleImplementation
    require.js:323:4
guardedLoadModule
    require.js:212:11
metroRequire
    require.js:130:6
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:234779:44
loadModuleImplementation
    require.js:323:4
guardedLoadModule
    require.js:212:11
metroRequire
    require.js:130:6
12 Answers

✔️Accepted Answer

Experiencing the same problems as @blumendorf during jest testing

Edit: This is because with v5 we now need to mock the module implementation like:

jest.mock('react-native-geolocation-service', () => ({
  requestAuthorization: jest.fn(),
  getCurrentPosition: jest.fn(),
  ...
}));

More Issues: