LocationState

interface LocationState

The current state of the useLocation hook.

Properties

currentLocation

currentLocation: 
  | Location
  | undefined

The last known user Location, or undefined if no location has been reported yet (e.g. because permission has not been granted, or because the device is still acquiring a fix).


hasPermission

hasPermission: boolean

Whether the app has been granted permission to access the user's location.

If this is false, call requestPermission() to prompt the user.

Methods

requestPermission()

requestPermission(): Promise<boolean>

Requests the location permission from the user.

Resolves with whether the permission was granted after the request completed.

On this page