Unverified Commit 38fa92a1 authored by benguedj's avatar benguedj Committed by GitHub
Browse files

fix: 🐛 Corrige le loader sur la carto (access GPS : refused) (#547)

 Closes: #544
parent b99b7cb3
......@@ -19,6 +19,8 @@ interface Props {
setFetchedPois: (pois: CartographiePoisFromDB[]) => void;
chooseFilterMessage: () => void;
searchIsReady: boolean;
setIsLoading: (value: boolean) => void;
locationPermissionIsGranted: boolean;
}
const FetchPoisCoords: React.FC<Props> = ({
......@@ -28,6 +30,8 @@ const FetchPoisCoords: React.FC<Props> = ({
setFetchedPois,
chooseFilterMessage,
searchIsReady,
setIsLoading,
locationPermissionIsGranted,
}) => {
const [getPoisByGpsCoords] = useLazyQuery(
DatabaseQueries.AROUNDME_POIS_BY_GPSCOORDS,
......@@ -92,6 +96,7 @@ const FetchPoisCoords: React.FC<Props> = ({
useEffect(() => {
if (!searchIsReady) {
if (!locationPermissionIsGranted) setIsLoading(false);
return;
}
void searchByGPSCoords();
......
......@@ -34,6 +34,7 @@ interface Props {
setIsLoading: (value: boolean) => void;
updateUserLocation: (coordinates: LatLng | undefined) => void;
setSearchIsReady: (value: boolean) => void;
setLocationPermissionIsGranted: (value: boolean) => void;
}
const SearchByPostalCode: React.FC<Props> = ({
......@@ -47,6 +48,7 @@ const SearchByPostalCode: React.FC<Props> = ({
setIsLoading,
updateUserLocation,
setSearchIsReady,
setLocationPermissionIsGranted,
}) => {
useEffect(() => {
setSearchIsReady(false);
......@@ -61,6 +63,7 @@ const SearchByPostalCode: React.FC<Props> = ({
return;
}
setLocationPermissionIsGranted(true);
setIsLoading(true);
try {
const currentLocation = await Location.getCurrentPositionAsync({});
......
......@@ -73,6 +73,8 @@ const TabAroundMeScreen: React.FC = () => {
null
);
const [searchIsReady, setSearchIsReady] = useState(false);
const [locationPermissionIsGranted, setLocationPermissionIsGranted] =
useState(false);
const googleMapsNotSelectedIcon = require("../../assets/images/carto/icon_google_map_not_selected.png");
const googleMapsSelectedIcon = require("../../assets/images/carto/icon_google_map_selected.png");
......@@ -209,6 +211,8 @@ const TabAroundMeScreen: React.FC = () => {
showSnackBarWithMessage(Labels.aroundMe.chooseFilter);
}}
searchIsReady={searchIsReady}
setIsLoading={setIsLoading}
locationPermissionIsGranted={locationPermissionIsGranted}
/>
<View style={styles.topContainer}>
<TitleH1
......@@ -254,6 +258,7 @@ const TabAroundMeScreen: React.FC = () => {
setMoveToRegionBecauseOfPCResearch(true);
}}
setSearchIsReady={setSearchIsReady}
setLocationPermissionIsGranted={setLocationPermissionIsGranted}
/>
<View style={styles.map}>
<MapView
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment