- SDK Version: 43
- Platforms(Android/iOS/web/all): Android
I’m having a weird issue with getCurrentPositionAsync. I have a file called MapView.js with the following code:
componentDidMount = () => {
this.getCurrentLocation();
}
getCurrentLocation = async () => {
let { status } = await Location.requestForegroundPermissionsAsync();
console.log(status + "First log")
if (status !== 'granted') {
this.setState({
...this.state,
userLocationPermission: false
});
} else {
console.log(status + "Second log")
let location = await Location.getCurrentPositionAsync({});
console.log(location + "Third log") // Anything beyond this line doens't run. The above line just hangs indefinetly.
this.setState({
...this.state,
latitude: location.coords.latitude,
longitude: location.coords.longitude,
userLocationPermission: true
});
}
}
It just stops and doesn’t continue past that specific line. Am I doing something wrong or what is happening? This code used to work without issue.