Hey all.
Trying to get location information for a simple screen on my app.
I am currently on SDK version 32, and running the iOS simulator on the latest version of iOS (iPhone XR). I have also tried this on my Galaxy S9 (Physical) running the Expo client app, with the same result.
When attempting to use expo-permissions, I get the following warning:
Possible Unhandled Promise Rejection (id: 0): TypeError: Permissions.askAsync is not a function. (In ‘Permissions.askAsync(Permissions.LOCATION)’, 'Permissions.askAsync is undefined)
Here is the relevant code:
import React from "react";
import { Platform, View, Button, Text } from "react-native";
import NavigationService from "../NavigationService";
import Constants from "expo-constants";
import * as Location from "expo-location";
import * as Permissions from "expo-permissions";
export default class SalatTimes extends React.Component {
...
_getLocationAsync = async () => {
console.log(Permissions);
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== "granted") {
this.setState({
errorMessage: "Permission to access location was denied"
});
}
let location = await Location.getCurrentPositionAsync({});
this.setState({ location });
};
componentDidMount() {
this._getLocationAsync();
...
}
This code is pulled exactly from the Expo docks. Anyone have anywhere for me to look to figure out why this is happening?
Edit:
copied and pasted my exact code into a snack and it works fine. https://snack.expo.io/rJ0EuSAMb
So something is wrong with my development environment but I am not sure where to start.