Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 997
kentonpalmer Avatar asked Sep 04 '19 04:09

kentonpalmer


2 Answers

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

like image 167
Ben Butterworth Avatar answered Nov 17 '22 18:11

Ben Butterworth


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

like image 1
sabrim Avatar answered Nov 17 '22 18:11

sabrim