Expo: Remove watchPositionAsync

Created on 4 May 2017  路  3Comments  路  Source: expo/expo

Have som problems with calling the function to remove watchPositionAsync.

This is my code:

const getLocation = (position) => {
  console.log(position);
}

const location = Location.watchPositionAsync({
enableHighAccuracy: true,
}, getLocation);

As i read the docs location are returning a remove function, which i call like this:

location.remove();

But it is returning undefined.
Am I doing something wrong?
Anyone else having similar problem?

Most helpful comment

@fredjens @sonaye is correct. The correct code would be:

const location = await Location.watchPositionAsync({
  enableHighAccuracy: true,
}, getLocation);

All 3 comments

it's async, implement it asynchronously.

@fredjens @sonaye is correct. The correct code would be:

const location = await Location.watchPositionAsync({
  enableHighAccuracy: true,
}, getLocation);

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikadze picture mikadze  路  3Comments

Rhjulskov picture Rhjulskov  路  3Comments

clems36 picture clems36  路  3Comments

muescha picture muescha  路  3Comments

peacemind picture peacemind  路  3Comments