Geolocation and MapView not working

export default class MapScreen extends React.Component {

  async getLocationAsync() {
    const { status } = await Permissions.askAsync(Permissions.LOCATION);
    if (status === 'granted') {
      return Location.getCurrentPositionAsync({enableHighAccuracy: true});
    } else {
      throw new Error('Location permission not granted');
    }
  }

  render() {
    return (
      <SafeAreaView>
        <MapView
          style={{flex: 1}}
          initialRegion={{
            latitude: 37.78825,
            longitude: -122.4324,
            latitudeDelta: 0.0922,
            longitudeDelta: 0.0421,
          }}
        />
      </SafeAreaView>
    );
  }
}

My code is this one, I tried with other approaches that were more difficult and they didn’t work either, so I show you this simple one that should work.
I get no error in the phone (I am trying on an Android device):

Next: I do not get the permissions pop up to allow or deny it. It simply doesn’t appear.
Sometimes I get a warning saying that I have no authorization to the location (on those time the permissions message appears and this warning comes up when I clicked in ALLOW)

I can’t undertand why this is happening. My version of expo is the last one.

The problem is SafeAreaView, when I delete it then it worked perfectly.
Seems that only works on iOs form 11 to above, the thing is that I didn’t get that from the expo documentation.
Anyway, solved, no need of replying.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.