Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should raise an error when call function with invalid arguments', () => {
// $ExpectError: need a string
hasStartedGeofencingAsync(69);
});
});
it('should passes when used properly', () => {
hasStartedGeofencingAsync('taskName').then(result => {
(result: boolean);
// $ExpectError: check any
(result: string);
});
});
async () => {
if (await Location.hasStartedGeofencingAsync(GEOFENCING_TASK)) {
// update existing geofencing task
await Location.startGeofencingAsync(GEOFENCING_TASK, this.state.geofencingRegions);
}
}
);
onMapPress = async ({ nativeEvent: { coordinate } }: MapEvent) => {
const geofencingRegions = [...this.state.geofencingRegions];
geofencingRegions.push({
identifier: `${coordinate.latitude},${coordinate.longitude}`,
latitude: coordinate.latitude,
longitude: coordinate.longitude,
radius: 50,
});
this.setState({ geofencingRegions });
if (await Location.hasStartedGeofencingAsync(GEOFENCING_TASK)) {
// update existing geofencing task
await Location.startGeofencingAsync(GEOFENCING_TASK, geofencingRegions);
}
}