Viktoriia 4 тижнів тому
батько
коміт
8a782672c5

+ 12 - 2
src/screens/InAppScreens/TravelsScreen/EventScreen/index.tsx

@@ -142,6 +142,7 @@ const EventScreen = ({ route }: { route: any }) => {
   const { data: photosData } = useGetPhotosForRegionQuery(nmId ?? 0, nmId !== null);
   const { mutateAsync: getPhotosForRegion } = usePostGetPhotosForRegionMutation();
   const [regions, setRegions] = useState<any[]>([]);
+  const [isSubmitting, setIsSubmitting] = useState(false);
 
   const [modalInfo, setModalInfo] = useState({
     visible: false,
@@ -488,6 +489,7 @@ const EventScreen = ({ route }: { route: any }) => {
         action: () => {}
       });
     }
+    setIsSubmitting(true);
 
     await joinEvent(
       { token, id: event.id },
@@ -495,6 +497,10 @@ const EventScreen = ({ route }: { route: any }) => {
         onSuccess: () => {
           setJoined(1);
           refetch();
+          setIsSubmitting(false);
+        },
+        onError: () => {
+          setIsSubmitting(false);
         }
       }
     );
@@ -1723,11 +1729,15 @@ const EventScreen = ({ route }: { route: any }) => {
                   backgroundColor: Colors.ORANGE,
                   gap: 6,
                   borderWidth: 1,
-                  borderColor: Colors.ORANGE
+                  borderColor: Colors.ORANGE,
+                  minHeight: 36
                 }}
                 onPress={handleJoinEvent}
+                disabled={isSubmitting}
               >
-                {event.settings.type === 1 ? (
+                {isSubmitting ? (
+                  <ActivityIndicator animating={true} color={'#fff'} size={16} />
+                ) : event.settings.type === 1 ? (
                   <>
                     <GigtIcon fill={Colors.WHITE} width={16} height={16} />
                     <Text