26 lines
717 B
TypeScript
26 lines
717 B
TypeScript
// expo-router can't return a value from a pushed screen, so the map picker
|
|
// parks its result here and the form claims it on focus.
|
|
|
|
export interface PickedLocation {
|
|
latitude: number;
|
|
longitude: number;
|
|
/** Reverse-geocoded, so the form can offer to fill the address. */
|
|
address?: string | null;
|
|
postalCode?: string | null;
|
|
city?: string | null;
|
|
country?: string | null;
|
|
}
|
|
|
|
let pending: PickedLocation | null = null;
|
|
|
|
export function setPendingLocation(value: PickedLocation): void {
|
|
pending = value;
|
|
}
|
|
|
|
/** Returns the pending pick and clears it, so it is applied once. */
|
|
export function takePendingLocation(): PickedLocation | null {
|
|
const value = pending;
|
|
pending = null;
|
|
return value;
|
|
}
|