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
stopGeofencingAsync(69);
});
});
it('should passes when used properly', () => {
stopGeofencingAsync('taskName').then(result => {
(result: void);
// $ExpectError: check any
(result: string);
});
});
toggleGeofencing = async () => {
if (!this.canToggleGeofencing()) {
return;
}
if (this.state.isGeofencing) {
await Location.stopGeofencingAsync(GEOFENCING_TASK);
this.setState({ geofencingRegions: [] });
} else {
await Location.startGeofencingAsync(GEOFENCING_TASK, this.state.geofencingRegions);
alert(
'You will be receiving notifications when the device enters or exits from selected regions.'
);
}
this.setState(state => ({ isGeofencing: !state.isGeofencing }));
};
toggleGeofencing = async () => {
if (this.state.isGeofencing) {
await Location.stopGeofencingAsync(GEOFENCING_TASK);
this.setState({ geofencingRegions: [] });
} else {
await Location.startGeofencingAsync(GEOFENCING_TASK, this.state.geofencingRegions);
}
this.setState({ isGeofencing: !this.state.isGeofencing });
}