Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const LOCATION_UPDATES_TASK = 'location-updates';
const locationEventsEmitter = new EventEmitter();
const locationAccuracyStates: { [key in Location.Accuracy]: Location.Accuracy } = {
[Location.Accuracy.Lowest]: Location.Accuracy.Low,
[Location.Accuracy.Low]: Location.Accuracy.Balanced,
[Location.Accuracy.Balanced]: Location.Accuracy.High,
[Location.Accuracy.High]: Location.Accuracy.Highest,
[Location.Accuracy.Highest]: Location.Accuracy.BestForNavigation,
[Location.Accuracy.BestForNavigation]: Location.Accuracy.Lowest,
};
const locationActivityTypes: { [key in Location.ActivityType]: Location.ActivityType | undefined } = {
[Location.ActivityType.Other]: Location.ActivityType.AutomotiveNavigation,
[Location.ActivityType.AutomotiveNavigation]: Location.ActivityType.Fitness,
[Location.ActivityType.Fitness]: Location.ActivityType.OtherNavigation,
[Location.ActivityType.OtherNavigation]: Location.ActivityType.Airborne,
[Location.ActivityType.Airborne]: undefined,
};
interface Props {
navigation: NavigationScreenProp<{}, any>;
}
interface State {
accuracy: Location.Accuracy;
activityType?: Location.ActivityType;
isTracking: boolean;
savedLocations: [];
geofencingRegions: [];
initialRegion?: any;
const STORAGE_KEY = 'expo-home-locations';
const LOCATION_UPDATES_TASK = 'location-updates';
const locationEventsEmitter = new EventEmitter();
const locationAccuracyStates: { [key in Location.Accuracy]: Location.Accuracy } = {
[Location.Accuracy.Lowest]: Location.Accuracy.Low,
[Location.Accuracy.Low]: Location.Accuracy.Balanced,
[Location.Accuracy.Balanced]: Location.Accuracy.High,
[Location.Accuracy.High]: Location.Accuracy.Highest,
[Location.Accuracy.Highest]: Location.Accuracy.BestForNavigation,
[Location.Accuracy.BestForNavigation]: Location.Accuracy.Lowest,
};
const locationActivityTypes: { [key in Location.ActivityType]: Location.ActivityType | undefined } = {
[Location.ActivityType.Other]: Location.ActivityType.AutomotiveNavigation,
[Location.ActivityType.AutomotiveNavigation]: Location.ActivityType.Fitness,
[Location.ActivityType.Fitness]: Location.ActivityType.OtherNavigation,
[Location.ActivityType.OtherNavigation]: Location.ActivityType.Airborne,
[Location.ActivityType.Airborne]: undefined,
};
interface Props {
navigation: NavigationScreenProp<{}, any>;
}
interface State {
accuracy: Location.Accuracy;
activityType?: Location.ActivityType;
isTracking: boolean;
savedLocations: [];
geofencingRegions: [];