expo-osm-sdk
Version:
OpenStreetMap component for React Native with Expo
48 lines • 1.7 kB
TypeScript
/**
* useGeofencing Hook
*
* Real-time geofencing for location-based apps
*
* Features:
* - Circle and polygon geofences
* - Enter, exit, and dwell events
* - Multiple geofence monitoring
* - Performance optimized
* - TypeScript support
*
* @example
* ```tsx
* const { activeGeofences, isInGeofence } = useGeofencing(geofences, {
* onEnter: (event) => console.log('Entered:', event.geofenceName),
* onExit: (event) => console.log('Exited:', event.geofenceName),
* checkInterval: 5000,
* });
* ```
*/
import React from 'react';
import type { Geofence, GeofenceEvent, GeofenceState, UseGeofencingOptions, UseGeofencingReturn, Coordinate, OSMViewRef } from '../types';
/**
* Hook for monitoring geofences and detecting enter/exit/dwell events
*
* @param mapRef Reference to OSMView component
* @param geofences Array of geofences to monitor
* @param options Configuration options
* @returns Geofencing state and controls
*/
export declare function useGeofencing(mapRef: React.RefObject<OSMViewRef>, geofences: Geofence[], options?: UseGeofencingOptions): UseGeofencingReturn;
/**
* Simple helper hook for single geofence monitoring
*/
export declare function useSingleGeofence(mapRef: React.RefObject<OSMViewRef>, geofence: Geofence, options?: UseGeofencingOptions): {
isInside: boolean;
dwellTime: number;
activeGeofences: string[];
geofenceStates: Map<string, GeofenceState>;
isInGeofence: (geofenceId: string) => boolean;
getDwellTime: (geofenceId: string) => number;
checkGeofences: () => void;
currentLocation: Coordinate | null;
isTracking: boolean;
events: GeofenceEvent[];
};
//# sourceMappingURL=useGeofencing.d.ts.map