Browse Source

trips screen limit for regions

Viktoriia 2 weeks ago
parent
commit
19d3e9ebfb
1 changed files with 13 additions and 1 deletions
  1. 13 1
      src/screens/InAppScreens/TravelsScreen/AddNewTripScreen/index.tsx

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

@@ -1,5 +1,5 @@
 import React, { useEffect, useState, useRef } from 'react';
-import { View, Text, TouchableOpacity, ScrollView } from 'react-native';
+import { View, Text, TouchableOpacity, ScrollView, Alert } from 'react-native';
 import ReactModal from 'react-native-modal';
 import { useNavigation } from '@react-navigation/native';
 import { Picker as WheelPicker } from 'react-native-wheel-pick';
@@ -364,6 +364,12 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
         };
       });
 
+      if (regionsData.length >= 30) {
+        Alert.alert('One trip cannot have more than 30 regions.');
+        setIsLoading(null);
+        return;
+      }
+
       saveNewTrip(
         {
           token,
@@ -406,6 +412,12 @@ const AddNewTripScreen = ({ route }: { route: any }) => {
         };
       });
 
+      if (regionsData.length >= 30) {
+        Alert.alert('One trip cannot have more than 30 regions.');
+        setIsLoading(null);
+        return;
+      }
+
       updateTrip(
         {
           token,