I am using the code below to ask for location permission only for iOS devices when the component renders, below is the code snippet:
if (!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)) {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
success => {
if (success) {
const coords = {
lat: success.coords.latitude,
lng: success.coords.longitude,
};
this.fetchNearestLocation(coords);
this.setState({ showCurrLocationMarker: true });
this.setState({ isCurrentLocationBlocked: false });
}
},
error => {
if (error && error.code) {
this.setState({ showCurrLocationMarker: false });
this.setState({ isCurrentLocationBlocked: true });
}
},
);
}
}
The issue here is that once the location access is blocked for Safari browser from the settings, and after sometime it is enabled again, I won't get the location permission popup at all.
I am confused whether the issue is related to the code or the browser (settings).
I was expecting to get a location permission pop-up on when the component renders on an iOS device on Safari browser.