NativeModule RNCGeolocation is null
Asked Answered
C

2

13

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

Communal answered 4/9, 2019 at 4:20 Comment(4)
did you update the import statement to something like this? import Geolocation from "@react-native-community/geolocation";Calamanco
yes but I still receive the same error after importing Geolocation from @react-native-community/geolocationCommunal
make sure that you have geolocation folder in node_modules/@react-native-communityCalamanco
I do have these files yet the error still persists, do you have any other suggestions I can tryCommunal
P
2

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

Pilferage answered 28/12, 2019 at 12:48 Comment(0)
K
1

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

Kaufman answered 7/6, 2022 at 9:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.