react-native-geolocation icon indicating copy to clipboard operation
react-native-geolocation copied to clipboard

RNCGeolocation is null

Open njlcll opened this issue 5 years ago • 16 comments

Ask your Question

i am running with windows running latest version rn and expo to my iphone i have tried just adding to a working home page import Geolocation from '@react-native-community/geolocation'; I get error NativeModule.RNCGeolocation is null is null

njlcll avatar Feb 11 '20 20:02 njlcll

Any update on this issue, Ive come across this problem today.

Liz6124 avatar Feb 26 '20 16:02 Liz6124

Happens to me as well. Reverted back to v1.4.2 at the moment, but i'm facing another issue on another lib that is quite related to this feat

sshanzel avatar Mar 12 '20 13:03 sshanzel

Is anybody solved this issue?

deniskk12 avatar Mar 19 '20 10:03 deniskk12

I choose to go down another route, so I dont know if its been fixed

Liz6124 avatar Mar 19 '20 11:03 Liz6124

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

This changes to Podfile solved it for me.

deniskk12 avatar Mar 20 '20 09:03 deniskk12

I'm having this same problem on Android

pedrofnuness avatar Mar 20 '20 18:03 pedrofnuness

You should use Expo's native API instead: https://reactnativemaster.com/react-native-geolocation-example/

rasmusrim avatar Mar 31 '20 14:03 rasmusrim

Getting same issue on Android. changing podfile path wont fix it.

abhishrek avatar Jul 03 '20 09:07 abhishrek

updating to 2.0.2 and removing the below line from Podfile fixed the related issues (from android and ios both) pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'

abhishrek avatar Aug 08 '20 01:08 abhishrek

You should use Expo's native API instead: https://reactnativemaster.com/react-native-geolocation-example/

I ended up using Expo's native API, as I am using expo already. No trouble so far.

claugf avatar Nov 18 '20 03:11 claugf

Hi @njlcll !

On Android device, i have just tried to use the 'react-native-geolocation-service' and it really worked for me!

yarn add react-native-geolocation-service

As the API format is really similar, I had just to change the import line. Please, check it out!

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

Thats all! Thanks!

rogeriocassares avatar Feb 04 '21 16:02 rogeriocassares

Hi i have solve this issue in expo project by using expo expo pakage manager if you use

expo install @react-native-community/geolocation

then your issue will solve because it auto link you library after installation.

azeem-sarwar avatar May 19 '21 06:05 azeem-sarwar

Hi i have solve this issue in expo project by using expo expo pakage manager if you use

expo install @react-native-community/geolocation

then your issue will solve because it auto link you library after installation.

@as1265513 still getting the same error after following your solution.

@roger10cassares what about iOS? Does the react-native-geolocation-service apply to iOS as well?

Could it be a iOS permission issue?

below is all I could find about location permissions.

if you provide both NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription, your application will only ask for "when in use" permission on iOS 10, whereas on iOS 11+ it will show a dialog to the user where he'll be able to pick whether he'd like to give your app permission to access location always or only when the app is in use,

Thanks

esadkrs avatar Jun 04 '21 03:06 esadkrs

Hi @esadkrs, I am sorry, I cannot tell you about since have any iOS devices

rogeriocassares avatar Jun 08 '21 18:06 rogeriocassares

Hi @njlcll !

On Android device, i have just tried to use the 'react-native-geolocation-service' and it really worked for me!

yarn add react-native-geolocation-service

As the API format is really similar, I had just to change the import line. Please, check it out!

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

Thats all! Thanks!

good call. Solved my problem.

joetorres avatar Jul 02 '21 02:07 joetorres

I was having the same issue and tried out both react-native-geolocation and @react-native-community/geolocation. Each time I was either getting "RNCGeolocation is null" or "Native module cannot be null." I am also using Expo on iPhone.

What worked for me is scrapping both those libraries and just using expo-location. You import it as follows:

import * as Location from "expo-location";

amamenko avatar Jul 06 '21 03:07 amamenko