question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invariant Violation: Native module cannot be null.

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

23reactions
jbolotincommented, Jul 27, 2020

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(),
  ...
}));
1reaction
pxl-livecommented, Jul 1, 2020

Guys! Make sure to create the swift file with bridging support as mentioned on Readme. Game changer, i promise! 🥇

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invariant Violation: Native module cannot be null #43 - GitHub
At iOS, it builds successfully, however, when the app starts, I get this error: Invariant Violation: Native module cannot be null.
Read more >
(React Native - Invariant Violation: Native module cannot be null
This module (aws-amplify@unstable) introduced an error saying TypeError: undefined is not an object (evaluating '_core.Amplify.register') so ...
Read more >
Invariant Violation: Native module cannot be null. on Managed ...
SDK Version: 41.0.0; Platforms(Android/iOS/web/all): Android/ios. I upgraded to SDK 41 yesterday and worked out some smaller issues before ...
Read more >
" has not been registered" and "Invariant Violation: Native ...
I am working on a project in React Native using Expo and Firebase. ... and "Invariant Violation: Native module cannot be null" errors ......
Read more >
Error Running mobile-preview "Invariant Violation: Native ...
Hello, trying to setup the mobile-preview app for component dev. Just trying to run the app in Xcode at this point, not loading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found