feat: add location distance filtering to useLocation hook and impleme… - #69
Merged
cybermax4200 merged 21 commits intoAug 24, 2026
Hidden character warning
The head ref may contain hidden characters: "hook\u2014permission-handling"
Merged
Conversation
…nt comprehensive test suite
cybermax4200
requested changes
Aug 19, 2026
cybermax4200
left a comment
Contributor
There was a problem hiding this comment.
The ci checks are failing, please kindly fix them
ABEEGOLD
force-pushed
the
hook—permission-handling
branch
from
August 19, 2026 13:17
495ddc1 to
8bcc4d5
Compare
ABEEGOLD
force-pushed
the
hook—permission-handling
branch
from
August 19, 2026 13:25
478542d to
2e0f86c
Compare
…ipt type compatibility issues across hooks, services, and tests
…native-maps and adding type assertions across services, hooks, and tests.
Contributor
Author
|
@cybermax4200 All checks passed. |
cybermax4200
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #67
Implement useLocation hook and comprehensive test suite
Description
This PR implements the full functionality for the
useLocationhook and adds a comprehensive test suite to ensure its reliability.Specifically, the following changes were made:
Geolocation.watchPositioninstead ofgetCurrentPositionfor continuous location updates.haversineDistanceto only update the state when the user has moved 50 meters (0.05 km) or more from their last recorded position.PermissionsAndroid), while gracefully skipping it on iOS where it is not required.Geolocation.clearWatchis called properly when the hook unmounts to prevent memory leaks and zombie listeners.src/__tests__/useLocation.test.tsxchecking all aspects of permission granting/denial, watch start, distance filtering, and cleanup.Type of Change
How Has This Been Tested?
Checklist
Screenshots
N/A
Additional Context
The hook previously only implemented a single
getCurrentPositionfetch upon mounting and lacked the necessary background watch or filtering. The tests take full advantage of Jest mocks to simulate various OS platforms and location events cleanly without depending on the device environment.