location.watch
Starts locating into position. In a component it starts when the
component mounts and stops when it unmounts; elsewhere the returned
subscription's remove() stops it. The platform locates only while a
watch runs.
Verwendung
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>;
}Signaturen
(options?: WatchPositionOptions): EventSubscriptionParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
options | WatchPositionOptions | Nein | — Standard: {} |
Rückgabe
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.