question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

navigator.geolocation.getCurrentLocation is undefined

See original GitHub issue

I have fixed this issue by the following steps,

In GooglePlacesAutocomplete.js file,

importing Geolocation from ‘@react-native-community/geolocation’ at the top, and replacing navigator.geolocation.getCurrentPosition to Geolocation.getCurrentPosition

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:6

github_iconTop GitHub Comments

2reactions
carmelocatalfamocommented, Sep 4, 2019

I fixed it without edit files in node_modules folder.

Refer to @react-native-community/geolocation

If you need to have geolocation API aligned with the browser (cross-platform apps), or want to support backward compatibility, please consider adding following lines at the root level, for example at the top of your App.js file (only for react native):

navigator.geolocation = require('@react-native-community/geolocation');
0reactions
LucasMallmanncommented, Feb 14, 2020

@carmelocatalfamo a quick question. Where am I supposed to edit this? Change this navigator config?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Current coordinates returns undefined - Stack Overflow
I'm trying to use getLocation function to get the current location coordinates and use those for distance calculation in future. After I run...
Read more >
Why does the geolocation API return undefined? - Reddit
The below code returns undefined. Why is that? In my mind the logic would be that the getLocation(), upon a successful retrieval of...
Read more >
Geolocation.getCurrentPosition() - Web APIs | MDN
The Geolocation.getCurrentPosition() method is used to get the current position of the device.
Read more >
navigator.geolocation.getCurrentLocation is undefined and ...
There's a solution for this. navigator.geolocation = require('@react-native-community/geolocation'); ...
Read more >
Navigator geolocation Property - W3Schools
navigator.geolocation.getCurrentPosition(showPosition); } else { document.getElementById("demo").innerHTML = "Geolocation is not supported by this browser.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found