Viktoriia 1 месяц назад
Родитель
Сommit
c0f45fdca1

+ 15 - 15
src/screens/InAppScreens/MapScreen/index.tsx

@@ -129,7 +129,7 @@ const sanitizeNomadsGeoJSON = (
 const generateFilter = (ids: number[]) => {
   const validIds = ids?.filter(isValidNumber) || [];
   if (validIds.length === 0) {
-    return ['boolean', false];
+    return ['==', ['get', 'id'], -1];
   }
   return ['in', ['get', 'id'], ['literal', validIds]];
 };
@@ -829,7 +829,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
     if (regionsVisited && regionsVisited.length) {
       setRegionsVisitedFilter(generateFilter(regionsVisited));
     } else {
-      setRegionsVisitedFilter(['boolean', false]);
+      setRegionsVisitedFilter(['==', ['get', 'id'], -1]);
     }
   }, [regionsVisited]);
 
@@ -837,7 +837,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
     if (countriesVisited && countriesVisited.length) {
       setCountriesVisitedFilter(generateFilter(countriesVisited));
     } else {
-      setCountriesVisitedFilter(['boolean', false]);
+      setCountriesVisitedFilter(['==', ['get', 'id'], -1]);
     }
   }, [countriesVisited]);
 
@@ -845,7 +845,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
     if (dareVisited && dareVisited.length) {
       setDareVisitedFilter(generateFilter(dareVisited));
     } else {
-      setDareVisitedFilter(['boolean', false]);
+      setDareVisitedFilter(['==', ['get', 'id'], -1]);
     }
   }, [dareVisited]);
 
@@ -1210,7 +1210,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
         setRenderCamera(true);
 
         requestAnimationFrame(() => {
-          cameraRef.current?.flyTo({center: coordinates as [number, number], duration});
+          cameraRef.current?.flyTo({ center: coordinates as [number, number], duration });
         });
 
         animationTimeoutRef.current = setTimeout(() => {
@@ -1218,7 +1218,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
           setRenderCamera(false);
         }, duration + 200);
       } else {
-        cameraRef.current?.flyTo({center: coordinates as [number, number], duration});
+        cameraRef.current?.flyTo({ center: coordinates as [number, number], duration });
 
         animationTimeoutRef.current = setTimeout(() => {
           isAnimatingRef.current = false;
@@ -1240,9 +1240,9 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
 
         requestAnimationFrame(() => {
           if (duration > 0) {
-            cameraRef.current?.easeTo({center, duration});
+            cameraRef.current?.easeTo({ center, duration });
           } else {
-            cameraRef.current?.jumpTo({center});
+            cameraRef.current?.jumpTo({ center });
           }
         });
 
@@ -1252,9 +1252,9 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
         }, (duration || 100) + 200);
       } else {
         if (duration > 0) {
-          cameraRef.current?.easeTo({center, duration});
+          cameraRef.current?.easeTo({ center, duration });
         } else {
-          cameraRef.current?.jumpTo({center});
+          cameraRef.current?.jumpTo({ center });
         }
 
         animationTimeoutRef.current = setTimeout(() => {
@@ -1274,7 +1274,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
         setRenderCamera(true);
 
         requestAnimationFrame(() => {
-          cameraRef.current?.zoomTo(zoomLevel, {duration});
+          cameraRef.current?.zoomTo(zoomLevel, { duration });
         });
 
         animationTimeoutRef.current = setTimeout(() => {
@@ -1282,7 +1282,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
           setRenderCamera(false);
         }, duration + 200);
       } else {
-        cameraRef.current?.zoomTo(zoomLevel, {duration});
+        cameraRef.current?.zoomTo(zoomLevel, { duration });
 
         animationTimeoutRef.current = setTimeout(() => {
           isAnimatingRef.current = false;
@@ -2029,10 +2029,10 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
   const handleUserPress = (event: any) => {
     const selectedFeature = event?.features?.[0] || event?.nativeEvent?.features?.[0];
     if (!selectedFeature) return;
-    
+
     const { coordinates } = selectedFeature.geometry;
     const { avatar, first_name, last_name, flag, id, last_seen } = selectedFeature.properties;
-    
+
     setSelectedUser({
       coordinates,
       avatar: avatar ? { uri: API_HOST + avatar } : logo,
@@ -2905,7 +2905,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
         message={
           'This feature is available to Premium users. Premium account settings can be managed on our website.'
         }
-        action={() => {}}
+        action={() => { }}
         onClose={() => setPremiumModalVisible(false)}
         title={'Premium Feature'}
       />

+ 1 - 1
src/screens/OfflineMapsScreen/SelectRegionsScreen/index.tsx

@@ -32,7 +32,7 @@ import { offlineMapManager } from '../OfflineMapManager';
 import LocationIcon from 'assets/icons/location.svg';
 
 const generateFilter = (ids: number[]) => {
-  if (!ids || ids.length === 0) return ['boolean', false];
+  if (!ids || ids.length === 0) return ['==', ['get', 'id'], -1];
   return ['in', ['get', 'id'], ['literal', ids]];
 };