Always refresh location when pressing refresh button

This commit is contained in:
Keannu Bernasol 2023-11-23 23:29:27 +08:00
parent 7cd549cad7
commit c0a8a8efc8

View file

@ -85,18 +85,11 @@ export default function Home() {
if (locationPermitted) {
let newLocation = await Location.getCurrentPositionAsync();
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);
await DistanceHandler(newLocation);
}
}
}
}
useEffect(() => {
console.log("changed");