mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2024-11-17 06:19:25 +08:00
Always refresh location when pressing refresh button
This commit is contained in:
parent
7cd549cad7
commit
c0a8a8efc8
1 changed files with 1 additions and 8 deletions
|
@ -85,15 +85,8 @@ export default function Home() {
|
||||||
if (locationPermitted) {
|
if (locationPermitted) {
|
||||||
let newLocation = await Location.getCurrentPositionAsync();
|
let newLocation = await Location.getCurrentPositionAsync();
|
||||||
if (newLocation) {
|
if (newLocation) {
|
||||||
// Only update location state if user's location has changed
|
|
||||||
if (
|
|
||||||
!location ||
|
|
||||||
newLocation.coords.latitude !== location.coords.latitude ||
|
|
||||||
newLocation.coords.longitude !== location.coords.longitude
|
|
||||||
) {
|
|
||||||
setLocation(newLocation);
|
setLocation(newLocation);
|
||||||
await DistanceHandler(newLocation);
|
await DistanceHandler(newLocation);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue