How to use expo-location - 10 common examples

To help you get started, we’ve selected a few expo-location examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    startLocationUpdatesAsync();

    // $ExpectError: first argument mush be a string
    startLocationUpdatesAsync(1337);

    // $ExpectError: second argument must be an object
    startLocationUpdatesAsync('taskName', 69);

    startLocationUpdatesAsync('taskName', {
      // $ExpectError: invalid accuracy
      accuracy: 1,
      // $ExpectError: invalid activityType
      activityType: 1,

      // $ExpectError: `notificationTitle` is required props
      foregroundService: { notificationBody: 'str' },
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    startLocationUpdatesAsync();

    // $ExpectError: first argument mush be a string
    startLocationUpdatesAsync(1337);

    // $ExpectError: second argument must be an object
    startLocationUpdatesAsync('taskName', 69);

    startLocationUpdatesAsync('taskName', {
      // $ExpectError: invalid accuracy
      accuracy: 1,
      // $ExpectError: invalid activityType
      activityType: 1,

      // $ExpectError: `notificationTitle` is required props
      foregroundService: { notificationBody: 'str' },
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    startLocationUpdatesAsync();

    // $ExpectError: first argument mush be a string
    startLocationUpdatesAsync(1337);

    // $ExpectError: second argument must be an object
    startLocationUpdatesAsync('taskName', 69);

    startLocationUpdatesAsync('taskName', {
      // $ExpectError: invalid accuracy
      accuracy: 1,
      // $ExpectError: invalid activityType
      activityType: 1,

      // $ExpectError: `notificationTitle` is required props
      foregroundService: { notificationBody: 'str' },
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: need an object
    getCurrentPositionAsync(11);

    // $ExpectError: `__accuracy` is missing in enum
    getCurrentPositionAsync({ __accuracy: 1 });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should passes when used properly', () => {
    getCurrentPositionAsync({
      accuracy: Accuracy.High,
    }).then(result => {
      const { coords, timestamp } = result;

      (timestamp: number);

      (coords.latitude: number);
      (coords.speed: number);

      // $ExpectError: check any
      (coords.speed: string);
    });
  });
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    startGeofencingAsync();

    // $ExpectError: first argument mush be a string
    startGeofencingAsync(1337);

    startGeofencingAsync('taskName', [
      // $ExpectError: must be a region object
      69,
    ]);

    startGeofencingAsync('taskName', [
      {
        latitude: 14,
        longitude: 48,
        // $ExpectError: must be a number
        radius: '69',
      },
    ]);

    startGeofencingAsync('taskName', [
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: need a string
    stopLocationUpdatesAsync(69);
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should passes when used properly', () => {
    stopLocationUpdatesAsync('taskName').then(result => {
      (result: void);

      // $ExpectError: check any
      (result: string);
    });
  });
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    watchPositionAsync();

    // $ExpectError: first argument must be a n object
    watchPositionAsync(69);

    // $ExpectError: second argument must be a function
    watchPositionAsync({}, 69);

    watchPositionAsync(
      {
        // $ExpectError: invalid accuracy value
        accuracy: 1,
      },
      () => {}
    );
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should passes when used properly', () => {
    watchPositionAsync({}, data => {
      const { coords, timestamp } = data;

      (timestamp: number);

      (coords.latitude: number);
      (coords.speed: number);

      // $ExpectError: check any
      (coords.speed: string);
    });
    watchPositionAsync({}, async () => {}).then(result => {
      result.remove();
    });
  });