location.position
The newest fix any watch brought; null until the first. A signal: fixes
come about once a second, not once a frame, so nothing needs to follow
them on the UI thread.
Utilisation
Request a current position
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>;
}Propriétés et méthodes 1
| Nom | Type | Requis | Description |
|---|---|---|---|
valuelecture seule | LocationObject | Oui | — |
value — champs imbriqués
value champs
| Nom | Type | Requis | Description |
|---|---|---|---|
coords | LocationCoords | Oui | — |
timestamp | number | Oui | Milliseconds since the epoch, when the fix was taken. |
mocked | boolean | Oui | The fix came from the iOS simulator or an Android mock-location app. |
coords — champs imbriqués
coords champs
| Nom | Type | Requis | Description |
|---|---|---|---|
latitude | number | Oui | — |
longitude | number | Oui | — |
altitude | number | Oui | Above sea level (iOS), or the WGS 84 ellipsoid (Android). |
accuracy | number | Oui | The radius of 68% confidence around the position. |
altitudeAccuracy | number | Oui | — |
heading | number | Oui | Degrees clockwise from true north that the device is moving. |
speed | number | Oui | Meters per second. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.