moonyeju 2023-11-15
[FIX] 모달창 수정 및, 파일 업로드 오류 수정
@481d681bd190c8b0fea87540932349fe900ed58f
src/component/Action.js
--- src/component/Action.js
+++ src/component/Action.js
@@ -86,29 +86,30 @@
         if (node === null || fog !== 'fog') {
           throw 'no data';
         }
-        onUploadFile(node);
+        // onUploadFile(node);
+        console.log('fog ' + fog + ' ' + isModalVisible);
         toggleModal();
         // 분석 결과 node remove 요청
-        return fetch(`${url}/trip/remove`, {
-          method: 'POST',
-          headers: {
-            'Content-Type': 'application/json; charset=UTF-8',
-          },
-          body: JSON.stringify({
-            gps_x: node[0],
-            gps_y: node[1],
-          }),
-        });
+        // return fetch(`${url}/trip/remove`, {
+        //   method: 'POST',
+        //   headers: {
+        //     'Content-Type': 'application/json; charset=UTF-8',
+        //   },
+        //   body: JSON.stringify({
+        //     gps_x: node[0],
+        //     gps_y: node[1],
+        //   }),
+        // });
       })
-      .then(response => response.json())
-      .then(data => {
-        console.log('remove data', data);
-        if (data.done === 'done') {
-          return;
-        }
-      })
+      // .then(response => response.json())
+      // .then(data => {
+      //   console.log('remove data', data);
+      //   if (data.done === 'done') {
+      //     return;
+      //   }
+      // })
       .catch(err => {
-        console.log(err);
+        console.log('re ' + err);
       });
   };
 
src/component/ModalComponent.js
--- src/component/ModalComponent.js
+++ src/component/ModalComponent.js
@@ -19,27 +19,38 @@
     <Modal
       isVisible={isVisible}
       style={{
-        position: 'absolute',
-        bottom: 40,
-        left: 0,
         width: '90%',
-        borderColor: RED,
-        borderWidth: 2,
-        borderRadius: 10,
-        overflow: 'hidden',
+        justifyContent: 'center',
+        alignItems: 'center',
       }}
       backdropOpacity={0}>
       <View
         style={{
+          borderColor: RED,
+          borderWidth: 2,
+          borderRadius: 10,
           backgroundColor: WHITE,
           padding: 22,
           borderRadius: 10,
           alignItems: 'center',
           justifyContent: 'center',
         }}>
-        <Text style={{color: RED, fontSize: 20}}>{alertTitle}</Text>
-        <Text style={{color: BLACK, fontSize: 15, marginTop: 5}}>
-          {alertMessage} 안전운행하세요.
+        <Text
+          style={{
+            color: RED,
+            fontSize: 20,
+          }}>
+          {alertTitle}
+        </Text>
+        <Text
+          style={{
+            color: BLACK,
+            fontSize: 15,
+            marginTop: 5,
+            textAlign: 'center',
+          }}>
+          {alertMessage}
+          {'\n'}안전운행하세요.
         </Text>
       </View>
     </Modal>
src/component/Photo.js
--- src/component/Photo.js
+++ src/component/Photo.js
@@ -97,28 +97,28 @@
         if (node === null || fog !== 'fog') {
           throw 'no data';
         }
-        onUploadFile(node);
+        // onUploadFile(node);
         toggleModal();
 
         // 분석 결과 node remove 요청
-        return fetch(`${url}/trip/remove`, {
-          method: 'POST',
-          headers: {
-            'Content-Type': 'application/json; charset=UTF-8',
-          },
-          body: JSON.stringify({
-            gps_x: node[0],
-            gps_y: node[1],
-          }),
-        });
+        // return fetch(`${url}/trip/remove`, {
+        //   method: 'POST',
+        //   headers: {
+        //     'Content-Type': 'application/json; charset=UTF-8',
+        //   },
+        //   body: JSON.stringify({
+        //     gps_x: node[0],
+        //     gps_y: node[1],
+        //   }),
+        // });
       })
-      .then(response => response.json())
-      .then(data => {
-        console.log('remove data', data);
-        if (data.done === 'done') {
-          return;
-        }
-      })
+      // .then(response => response.json())
+      // .then(data => {
+      //   console.log('remove data', data);
+      //   if (data.done === 'done') {
+      //     return;
+      //   }
+      // })
       .catch(err => {
         console.log(err);
       });
Add a comment
List