LocationObject
One position fix of the device, with when it was taken and whether a mock location supplied it.
Usage
Request a current position
This type is used by location.current
import { Text, location, permissions } from 'kuito';
const { status } = await permissions.request('location');
if (status === 'granted') {
const here = await location.current({ accuracy: 'high' });
const [place] = await location.reverseGeocode(here.coords);
}
function Here() {
// Locates while Here is mounted; the fixes land in location.position.
location.watch({ distanceInterval: 20 });
return <Text>{`${location.position.value?.coords.latitude ?? '…'}`}</Text>;
}Type declaration
export type LocationObject = Fix;Members 3
| Name | Type | Required | Description |
|---|---|---|---|
coords | LocationCoords | Yes | — |
timestamp | number | Yes | Milliseconds since the epoch, when the fix was taken. |
mocked | boolean | Yes | The fix came from the iOS simulator or an Android mock-location app. |
coords — nested fields
coords fields
| Name | Type | Required | Description |
|---|---|---|---|
latitude | number | Yes | — |
longitude | number | Yes | — |
altitude | number | Yes | Above sea level (iOS), or the WGS 84 ellipsoid (Android). |
accuracy | number | Yes | The radius of 68% confidence around the position. |
altitudeAccuracy | number | Yes | — |
heading | number | Yes | Degrees clockwise from true north that the device is moving. |
speed | number | Yes | Meters per second. |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.