소스 검색

sentry getCenter error fix

Viktoriia 1 일 전
부모
커밋
757e790ff4

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

@@ -864,10 +864,12 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
     setIsZooming(true);
 
     const currentZoom = await mapRef.current.getZoom();
-    const currentCenter = await mapRef.current.getCenter();
-
     setZoom(currentZoom);
-    setCenter(currentCenter);
+    
+    if (mapRef.current) {
+      const currentCenter = await mapRef.current?.getCenter();
+      setCenter(currentCenter);
+    }
   };
 
   const onMapPress = async (event: any) => {

+ 5 - 3
src/screens/InAppScreens/MessagesScreen/FullMapScreen/index.tsx

@@ -72,10 +72,12 @@ const FullMapScreen = ({ route }: { route: any }) => {
     setIsZooming(true);
 
     const currentZoom = await mapRef.current.getZoom();
-    const currentCenter = await mapRef.current.getCenter();
-
     setZoom(currentZoom);
-    setCenter(currentCenter);
+
+    if (mapRef.current) {
+      const currentCenter = await mapRef.current?.getCenter();
+      setCenter(currentCenter);
+    }
   };
 
   const handleGetLocation = async () => {

+ 5 - 3
src/screens/InAppScreens/ProfileScreen/UsersMap/index.tsx

@@ -246,10 +246,12 @@ const UsersMapScreen: FC<Props> = ({ navigation, route }) => {
     setIsZooming(true);
 
     const currentZoom = await mapRef.current.getZoom();
-    const currentCenter = await mapRef.current.getCenter();
-
     setZoom(currentZoom);
-    setCenter(currentCenter);
+
+    if (mapRef.current) {
+      const currentCenter = await mapRef.current?.getCenter();
+      setCenter(currentCenter);
+    }
   };
 
   const handleGetLocation = async () => {