Ver código fonte

location update new

Viktoriia 1 mês atrás
pai
commit
ea57b29d56
1 arquivos alterados com 5 adições e 5 exclusões
  1. 5 5
      src/screens/InAppScreens/MapScreen/index.tsx

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

@@ -420,7 +420,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
   const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
 
   const [markerCoords, setMarkerCoords] = useState<any>(null);
-  const [interval, setInterval] = useState(0);
+  const [refreshInterval, setRefreshInterval] = useState(0);
 
   const isSmallScreen = Dimensions.get('window').width < 383;
   const processedImages = useRef(new Set<string>());
@@ -703,16 +703,16 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
   );
 
   useEffect(() => {
-    if (interval > 0 && showNomads) {
+    if (refreshInterval > 0 && showNomads) {
       const intervalId = setInterval(() => {
         if (location && token && showNomads) {
           refetchUsersLocation();
         }
-      }, interval);
+      }, refreshInterval);
 
       return () => clearInterval(intervalId);
     }
-  }, [interval, showNomads]);
+  }, [refreshInterval, showNomads]);
 
   useEffect(() => {
     (async () => {
@@ -720,7 +720,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
       const isServicesEnabled = await Location.hasServicesEnabledAsync();
 
       if (locationSettings && locationSettings.sharing_refresh_interval) {
-        setInterval(locationSettings.sharing_refresh_interval * 1000);
+        setRefreshInterval(locationSettings.sharing_refresh_interval * 1000);
       }
 
       if (