Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isGeolocationEnabled returns true even after location is disabled #990

Open
manavpandya1995 opened this issue Feb 24, 2022 · 4 comments
Open

Comments

@manavpandya1995
Copy link

I want to check that if location is disabled, i want to surpass the location prompt

But "isGeolocationEnabled" returns "true" always which seems a weird issue

@no23reason Please check this accordingly

@burhanahmed92
Copy link

Yes same issue

@no23reason
Copy link
Owner

Hi @manavpandya1995 and @burhanahmed92 can you please share some more details? I tried reproducing this locally and when I block the geolocation, the isGeolocationEnabled correctly returns false.

@ghost
Copy link

ghost commented Jan 29, 2024

I am having the same issue too.

@ghost
Copy link

ghost commented Jan 29, 2024

I think I know the issue...

the hook does not remember some of the props sent to it.. example, suppressLocationOnMount is not in the dependencies of the useCallback... and thus, weird state issues...

useEffect(() => {
if (!suppressLocationOnMount) {
getPosition();
}

    return () => {
        cancelUserDecisionTimeout();
        if (watchPosition && watchId.current) {
            geolocationProvider?.clearWatch(watchId.current);
        }
    };
}, [permissionState]); // eslint-disable-line react-hooks/exhaustive-deps

you are expecting that we send either true or false, but inreality we send these based on states too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants