When I am using the navigator.geolocation.watchPosition on RN version 0.60 i shows a TypeError: Undefined is not an object (evaluating 'navigator.geolocation.watchPosition')
Meanwhile in version 0.57 it works just fine.
React Native version:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
Memory: 2.55 GB / 7.90 GB
Binaries:
Node: 12.4.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.16.0 - C:\Users\Scorpion\AppData\Roaming\npm\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
SDKs:
Android SDK:
Android NDK: 20.0.5594570
IDEs:
Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156
I expect it get me latitude and longitude but instead it shows me the error.
handleLocation = () => {
this.watchID = navigator.geolocation.watchPosition(
(position) => {
this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
error: null,
});
},
(error) => this.setState({ error: error.message }),
{ enableHighAccuracy: false, timeout: 2000, maximumAge: 100, distanceFilter: 10 },
);
Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?
馃憠 Click here if you want to take another look at the Bug Report issue template.
Hello.
Since RN 0.60, the Geolocation module was migrated out of RN Core.
You can find it at https://github.com/react-native-community/react-native-geolocation
Cheers!
See the comment above ^
The documentation is then out-of-date, as it still says you don't need to import anything to use geolocation in 0.61:
https://facebook.github.io/react-native/docs/geolocation
Most helpful comment
Hello.
Since RN 0.60, the Geolocation module was migrated out of RN Core.
You can find it at https://github.com/react-native-community/react-native-geolocation
Cheers!