inaturalist / iNaturalistReactNative

Cross-platform version of the iNat mobile app
MIT License
61 stars 21 forks source link

Explore defaults to worldwide #2032

Open kueda opened 1 week ago

kueda commented 1 week ago

Describe the bug On Android, going to Explore defaults to worldwide, even when you have already granted location permissions.

To Reproduce Steps to reproduce the behavior:

  1. Make sure you have granted location permissions
  2. Go to Explore
  3. Note that the header says "Nearby" briefly then switch to "Worldwide"
  4. Woldwide results load

Expected behavior Nearby results should load be default.

Context (please complete the following information):

israr002 commented 1 week ago

@kueda this issue is in getCurrentPosition in src/sharedHelpers/fetchUserLocation.ts as it is using geolocation and giving error {"ACTIVITY_NULL": 4, "PERMISSION_DENIED": 1, "POSITION_UNAVAILABLE": 2, "TIMEOUT": 3, "code": 3, "message": "Location request timed out"} this issue also raised by other users https://github.com/michalchudziak/react-native-geolocation/issues/272 we need to set enableHighAccuracy : false to make it work i have tested it and gives accurate result also i installed latest library version to test but still this change is needed. let me know if i can proceed to raise a pr

mtebele commented 1 week ago

Same issue here

kueda commented 1 week ago

Looks like https://github.com/michalchudziak/react-native-geolocation/pull/317 supposedly fixed it so maybe this is just a matter of updating a dependency. @israr002, sure, go ahead and work on this if you like, I'll assign you. Please try to update the library first and if that doesn't work, go ahead and try that workaround with enableHighAccuracy (high accuracy isn't really required on Explore anyway).

israr002 commented 1 week ago

@keuda i checked in the new version the issue is same. Also with enableHighAccuracy: false i tested by toggling simultaneously between worldwide and nearby it was failing sometimes so i have to remove the maximumAge: 0 after that it was working fine and giving accurate result

mtebele commented 1 week ago

Looks like michalchudziak/react-native-geolocation#317 supposedly fixed it so maybe this is just a matter of updating a dependency. @israr002, sure, go ahead and work on this if you like, I'll assign you. Please try to update the library first and if that doesn't work, go ahead and try that workaround with enableHighAccuracy (high accuracy isn't really required on Explore anyway).

Same issue with the latest version. With enableHighAccuracy:true it gives always timeout.