Browse Source

add event small fix

Viktoriia 1 month ago
parent
commit
55561f859e
1 changed files with 47 additions and 13 deletions
  1. 47 13
      src/screens/InAppScreens/TravelsScreen/CreateEvent/index.tsx

+ 47 - 13
src/screens/InAppScreens/TravelsScreen/CreateEvent/index.tsx

@@ -41,14 +41,14 @@ import { InputTimePicker } from 'src/components/Calendar/InputTimePicker';
 const EventSchema = yup.object({
   event_name: yup.string().required().min(3),
   date: yup.date().nullable().required(),
-  time: yup.date().nullable().optional(),
+  time: yup.date().nullable().required(),
   capacity: yup.number().optional(),
   region: yup.number().required(),
   photo: yup.number().nullable().optional(),
   city: yup.string().required(),
   address: yup.string().optional(),
   pin: yup.object().nullable().required(),
-  details: yup.string().optional()
+  details: yup.string().required()
 });
 
 const CreateEventScreen = () => {
@@ -301,11 +301,22 @@ const CreateEventScreen = () => {
                     <RichToolbar
                       editor={richText}
                       selectedButtonStyle={{ backgroundColor: Colors.LIGHT_GRAY }}
-                      style={{
-                        borderTopLeftRadius: 4,
-                        borderTopRightRadius: 4,
-                        backgroundColor: Colors.FILL_LIGHT
-                      }}
+                      style={[
+                        {
+                          borderTopLeftRadius: 4,
+                          borderTopRightRadius: 4,
+                          backgroundColor: Colors.FILL_LIGHT
+                        },
+                        props.touched.details && props.errors.details
+                          ? {
+                              borderTopColor: Colors.RED,
+                              borderLeftColor: Colors.RED,
+                              borderRightColor: Colors.RED,
+                              borderWidth: 1,
+                              borderBottomWidth: 0
+                            }
+                          : {}
+                      ]}
                       actions={[
                         actions.keyboard,
                         actions.setBold,
@@ -333,7 +344,7 @@ const CreateEventScreen = () => {
                       initialHeight={100}
                       onFocus={() => {
                         scrollRef.current?.scrollTo({
-                          y: 500,
+                          y: 650,
                           animated: true
                         });
                       }}
@@ -345,13 +356,36 @@ const CreateEventScreen = () => {
                         backgroundColor: Colors.FILL_LIGHT,
                         color: Colors.DARK_BLUE
                       }}
-                      style={{
-                        minHeight: 100,
-                        borderBottomLeftRadius: 4,
-                        borderBottomRightRadius: 4
-                      }}
+                      style={[
+                        {
+                          minHeight: 100,
+                          borderBottomLeftRadius: 4,
+                          borderBottomRightRadius: 4
+                        },
+                        props.touched.details && props.errors.details
+                          ? {
+                              borderBottomColor: Colors.RED,
+                              borderLeftColor: Colors.RED,
+                              borderRightColor: Colors.RED,
+                              borderWidth: 1,
+                              borderTopWidth: 0
+                            }
+                          : {}
+                      ]}
                       onBlur={() => props.handleBlur('details')}
                     />
+                    {props.touched.details && props.errors.details ? (
+                      <Text
+                        style={{
+                          color: Colors.RED,
+                          fontSize: getFontSize(12),
+                          fontFamily: 'redhat-600',
+                          marginTop: 5
+                        }}
+                      >
+                        {props.errors.details}
+                      </Text>
+                    ) : null}
                   </View>
 
                   <View style={{ marginTop: 15, marginBottom: 15, gap: 8 }}>