React-native-geolocation-service: Error : @react-native-community/geolocation:NativeModule.RNCGeolocation is null.

Created on 31 Jan 2020  路  11Comments  路  Source: Agontuk/react-native-geolocation-service

I installed the latest version and while using this library. I am getting:
Error : @react-native-community/geolocation:NativeModule.RNCGeolocation is null.

I have also successfully linked by using the below and rebuild and rerun the project.
react-native link @react-native-community/geolocation

Note : I am using expo cli project.

Most helpful comment

Try unlinking @react-native-community/geolocation (should not be needed on RN60+)
and then follow setup instructions(im guessing your issue is with iOS, you didnt state that):

  • Update your Podfile
pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'
  • Then run pod install from ios directory

All 11 comments

What version of RN are you using?

What version of RN are you using?
HI oakis I am using 0.61.4.

Try unlinking @react-native-community/geolocation (should not be needed on RN60+)
and then follow setup instructions(im guessing your issue is with iOS, you didnt state that):

  • Update your Podfile
pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'
  • Then run pod install from ios directory

@oakis Yes this issue is with ios and I tried updating podfile.
Note : I am expo cli for the project.

while doing that I am getting below error:

[!] Unknown command: react-native-geolocation,
Did you mean: deintegrate?

Usage:

$ pod COMMAND

  CocoaPods, the Cocoa library package manager.
pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'

The above is not a command, add it to your podfile (it is called just podfile).

Then run the command pod install.

I am working on windows platform and get the same problems. I use npm install to install and create a boilerplate
I am running 0.61.4.

i add the following to the home page
import Geolocation from '@react-native-community/geolocation';

if i run i get unable to resolve module @react-native-community/geolocation

I tried running
npm install @react-native-community/geolocation --save
I then get the same error as above
react-native-community/geolocation:NativeModule.RNCGeolocation is null.

I have no idea how to run the pod commands mentioned above
any help appreciated

@njlcll
You need to be on macOS to run pod commands since its for iOS.
You should NOT need to install @react-native-community/geolocation manually.

Thanks any idea why I get the errors below if I dont add manually
unable to resolve module @react-native-community/geolocation
after adding
import Geolocation from '@react-native-community/geolocation';
in code

or after
npm install @react-native-community/geolocation --save
the following line
import Geolocation from '@react-native-community/geolocation';
generates
react-native-community/geolocation:NativeModule.RNCGeolocation is null.
thanks

I have problem with installing it in expo based project.
Is there anything else I need to do after npm installing it?
I am getting this error
TypeError: Cannot read property 'getCurrentPosition' of undefined] node_modules\react-native-geolocation-service\js\Geolocation.android.js:15:24 in getCurrentPosition

I have problem with installing it in expo based project.
Is there anything else I need to do after npm installing it?
I am getting this error

TypeError: Cannot read property 'getCurrentPosition' of undefined]
node_modules\react-native-geolocation-service\js\Geolocation.android.js:15:24 in getCurrentPosition```

I haven't yet used expo, but as far as I know it does not support adding external native modules. You probably have to eject expo project to modify native dependencies.

I'll be removing the @react-native-community/geolocation dependency as I'm currently implementing ios module. You can track the progress here https://github.com/Agontuk/react-native-geolocation-service/issues/173.

Was this page helpful?
0 / 5 - 0 ratings