I'm trying to get the user's location in expo in react native. The enableNetworkproviderAsync() prompts a popup which enables the location. I want to re-open the popup when the user declines sharing their location. Currently when I navigate to my map screen the popup opens up only once and when I click on not sharing my location it won't re-open.
const [locationReady, setLocationReady] = useState(false);
useEffect(() => {
(async () => {
if (!locationReady) {
try {
const enableLocation = await Location.enableNetworkProviderAsync();
setLocationReady(true);
} catch (e) {
setLocationReady(false);
console.log("locationReady erorr");
}
}
})();
}, [locationReady]);