kentonpalmer
kentonpalmer

Reputation: 255

NativeModule RNCGeolocation is null

I upgraded to react native 60 and with it came Pods. Its too late to revert now. I get the error

@react-native-community/geolocation NativeModule.RNCGeolocation is Null.

Ive linked the module, uninstall reinstall module, uninstall node modules and reinstall, pod install, created new projects etc etc

Upvotes: 13

Views: 5052

Answers (2)

sabrim
sabrim

Reputation: 81

I'm building my app on an android device and I had the same issue! This is what solved my issue: 1: npm i 'react-native-geolocation-service

2: Changing this in "app.js"

// import Geolocation from '@react-native-community/geolocation';
import Geolocation from 'react-native-geolocation-service';

Here's the link to the issue on github: native-geolocation/issues

Upvotes: 1

Ben Butterworth
Ben Butterworth

Reputation: 28810

I had the same issue. I was actually using another library, which depended on @react-native-community/gelocation, which was react-native-geolocation-service. I didn't actually follow the installation steps for this. When I did, it worked. I guess since you're upgrading and have unlinked, you need to add this to the Podfile, as it might not support autolinking.

For RN version > 0.60, from geolocation service docs,

Update your 'Podfile' (Add the following to the Podfile)

`pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'`

Then run pod install from ios directory

Upvotes: 2

Related Questions