diff --git a/src/assets/images/svg/PhotoUploadIcon.svg b/src/assets/images/svg/PhotoUploadIcon.svg new file mode 100644 index 0000000..646be21 --- /dev/null +++ b/src/assets/images/svg/PhotoUploadIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/NewPost.js b/src/components/NewPost.js index d821d89..eacd69c 100644 --- a/src/components/NewPost.js +++ b/src/components/NewPost.js @@ -2,105 +2,162 @@ import React, { useState } from "react"; import { View, Text, StyleSheet, TextInput, TouchableOpacity, Image } from "react-native"; import {launchCamera, launchImageLibrary, CameraOptions, ImagePickerResponse, ImageLibraryOptions, Asset} from 'react-native-image-picker'; import axios from "axios"; +import PhotoUploadIcon from '../assets/images/svg/PhotoUploadIcon.svg'; const NewPost = () => { + const [photo, setPhoto] = useState(null); + const [text, setText] = useState(''); + const userId = 'user1'; - const [photo, setPhoto] = useState(null); - const [text, setText] = useState(''); - const userId = 'user1'; + const onSelectImage = () => { + launchImageLibrary( + { + mediaType: 'photo', + maxWidth: 512, + maxHeight: 512, + includeBase64: Platform.OS === 'android', + }, + (res) => { + console.log(res); + if (res.didCancel) return; + setPhoto(res); + } + ); + }; + const handleUploadPhoto = () => { + const formData = new FormData(); - const onSelectImage = () => { - launchImageLibrary( - { - mediaType: "photo", - maxWidth: 512, - maxHeight: 512, - includeBase64: Platform.OS === 'android', - }, - (res) => { - console.log(res); - if (res.didCancel) return; - setPhoto(res); - }, - ) - } - const handleUploadPhoto = () => { - const formData = new FormData(); + formData.append('img', { + name: photo.assets[0].fileName, + type: photo.assets[0].type, + uri: photo.assets[0].uri, + }); - formData.append("img", { - name: photo.assets[0].fileName, - type: photo.assets[0].type, - uri: photo.assets[0].uri, - }); + formData.append('writeTxt', text); - formData.append('writeTxt', text); + axios + .post(`http://52.79.97.196:8080/photobook/write/${userId}`, formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }) + .then((response) => { + console.log('upload success', response); + alert('Upload success!'); + setPhoto(null); + setText(''); + }) + .catch((error) => { + console.log('upload error', error); + alert('Upload failed!'); + }); + }; - axios.post(`http://52.79.97.196:8080/photobook/write/${userId}`, formData, { - headers: { - 'Content-Type': 'multipart/form-data' - } - }) - .then(response => { - console.log("upload success", response); - alert("Upload success!"); - setPhoto(null); - setText(''); - }) - .catch(error => { - console.log("upload error", error); - alert("Upload failed!"); - }); - }; - return ( - - {photo && ( - - )} - - Choose Photo - - setText(text)} - value={text} - /> - - Upload Photo - - - ); + return ( + + {photo && ( + + )} + {!photo && ( + + + 터치해서 사진을 선택해주세요! + + )} + setText(text)} + value={text} + /> + + 업로드 + + + ); }; const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: '#F5FCFF', - }, - button: { - backgroundColor: '#ff6200', - padding: 10, - borderRadius: 5, - alignItems: 'center', - marginTop: 10, + container: { + flex: 1, + alignItems: 'center', + justifyContent: 'center', + // backgroundColor: '#F5FCFF', + }, + photo: { + width: 300, + height: 300, + borderRadius: 30, + }, + selectPhotoButton: { + flexDirecion: 'row', + justifyContent: 'center', + alignItems: 'center', + width: 300, + height: 300, + borderRadius: 30, + backgroundColor: 'white', + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 2, }, - buttonText: { - color: '#fff', - fontSize: 16, + shadowOpacity: 0.25, + shadowRadius: 3.84, + elevation: 5, + }, + photoUploadIcon: { + width: 50, + height: 50, + fill: 'gray', + marginBottom: 30, + }, + selectPhotoButtonText: { + fontSize: 18, + fontWeight: '600', + color: 'gray' + }, + input: { + width: '90%', + height: 150, + borderRadius: 15, + marginTop: 30, + paddingHorizontal: 15, + paddingVertical: 5, + backgroundColor: '#FFF', + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 2, }, - input: { - height: 50, - width: 300, - borderColor: '#ddd', - borderWidth: 1, - marginTop: 10, - padding: 10, + shadowOpacity: 0.25, + shadowRadius: 3.84, + elevation: 5, + }, + button: { + width: 85, + backgroundColor: '#F7B599', + paddingHorizontal: 10, + paddingVertical: 7, + borderRadius: 10, + alignItems: 'center', + marginTop: 30, + + shadowColor: '#000', // 그림자 색상 + shadowOffset: { + width: 0, // 좌우 그림자 위치 + height: 2, // 상하 그림자 위치 }, + shadowOpacity: 0.25, // 그림자 투명도 + shadowRadius: 3.84, // 그림자 반경 + + elevation: 3, // Android에만 적용되는 그림자 깊이 + }, + buttonText: { + color: '#fff', + fontSize: 14, + }, }); -export default NewPost; +export default NewPost; \ No newline at end of file diff --git a/src/page/AlbumDedetailPage.js b/src/page/AlbumDedetailPage.js index 04e411a..58ed5f0 100644 --- a/src/page/AlbumDedetailPage.js +++ b/src/page/AlbumDedetailPage.js @@ -163,7 +163,7 @@ const styles = StyleSheet.create({ height: 40, borderWidth: 1, borderColor: '#ccc', - borderRadius: 4, + borderRadius: 10, paddingHorizontal: 10, marginRight: 10, }, @@ -171,7 +171,7 @@ const styles = StyleSheet.create({ backgroundColor: '#F7B599', paddingHorizontal: 15, paddingVertical: 8, - borderRadius: 4, + borderRadius: 10, }, commentButtonText: { color: 'white', diff --git a/src/page/QuizPostPage.js b/src/page/QuizPostPage.js index e72618f..efabe60 100644 --- a/src/page/QuizPostPage.js +++ b/src/page/QuizPostPage.js @@ -1,5 +1,5 @@ import React, { useContext, useState } from "react"; -import { View, TextInput, Button, StyleSheet } from 'react-native'; +import { View, TextInput, Button, StyleSheet, TouchableOpacity, Text } from 'react-native'; import { RadioButton } from 'react-native-paper'; import { UserContext } from "../../App"; @@ -38,33 +38,40 @@ const QuizPostPage = () => { return ( - - + Quiz + + - {[answer1, answer2, answer3, answer4].map((answer, index) => ( - - setQuizAns(String(index + 1))} - /> - { - if (index === 0) setAnswer1(text); - else if (index === 1) setAnswer2(text); - else if (index === 2) setAnswer3(text); - else if (index === 3) setAnswer4(text); - }} - /> - - ))} -