Parcourir la source

trips small modal fix

Viktoriia il y a 11 mois
Parent
commit
a4b7df2c72

+ 1 - 7
src/screens/InAppScreens/TravelsScreen/AddNewTripScreen/index.tsx

@@ -35,7 +35,6 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
   const [qualitySelectorVisible, setQualitySelectorVisible] = useState(false);
   const [selectedRegionId, setSelectedRegionId] = useState<number | null>(null);
   const [isWarningModalVisible, setIsWarningModalVisible] = useState(false);
-  const [tripDeleted, setTripDeleted] = useState(false);
 
   const { mutate: saveNewTrip } = usePostSetNewTripMutation();
   const { mutate: updateTrip } = usePostUpdateTripMutation();
@@ -145,7 +144,7 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
       },
       {
         onSuccess: () => {
-          setTripDeleted(true);
+          navigation.navigate(...([NAVIGATION_PAGES.TRIPS, { deleted: true }] as never))
         }
       }
     );
@@ -350,11 +349,6 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
       <WarningModal
         type={'delete'}
         isVisible={isWarningModalVisible}
-        onModalHide={() => {
-          if (tripDeleted) {
-            navigation.navigate(...([NAVIGATION_PAGES.TRIPS, { deleted: true }] as never));
-          }
-        }}
         onClose={() => setIsWarningModalVisible(false)}
         title="Delete Trip"
         message="Are you sure you want to delete your trip?"