Skip to content

Commit

Permalink
Merge branch 'main' into KAN-131
Browse files Browse the repository at this point in the history
  • Loading branch information
m1nse0kim authored Jun 1, 2024
2 parents f79ae8f + 98a132a commit cd26693
Show file tree
Hide file tree
Showing 11 changed files with 757 additions and 624 deletions.
1,046 changes: 525 additions & 521 deletions android/app/src/main/assets/index.android.bundle

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 35 additions & 10 deletions src/assets/svg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion src/components/StoreCompo.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function StoreCompo(props) {

const scrollViewRef = useRef();

const {storeData, index, addPadding} = props;
const {storeData, index, addPadding, fade} = props;

console.log('storeData', storeData);
return (
Expand Down Expand Up @@ -86,6 +86,18 @@ export default function StoreCompo(props) {
uri: storeData.representativeImageUrl,
}}
/>

{fade ? (
<View
style={{
position: 'absolute',
width: windowWidth / 3,
height: windowWidth / 3,
backgroundColor: 'rgba(0, 0, 0, 0.3)',
borderRadius: 10,
}}
/>
) : null}
<View
style={{
flex: 1,
Expand Down
7 changes: 6 additions & 1 deletion src/components/TodayPick.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ export default function TodayPick(props) {
ref={scrollViewRef}>
{todaysPick.map((pickData, index) => {
return (
<StoreCompo storeData={pickData} index={index} addPadding={10} />
<StoreCompo
storeData={pickData}
index={index}
addPadding={10}
fade={true}
/>
);
})}
</ScrollView>
Expand Down
107 changes: 48 additions & 59 deletions src/screens/detail/ReviewWriteScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
TextInput,
FlatList,
Pressable,
TouchableWithoutFeedback,
Alert,
} from 'react-native';
import {
Expand Down Expand Up @@ -57,7 +58,7 @@ export default function ReviewWriteScreen(props) {
const [showRatingError, setShowRatingError] = useState(false);
const [showContentError, setShowContentError] = useState(false);
const [showImageError, setShowImageError] = useState(false);
const [reviewImage, setReviewImage] = useState([]);
const [reviewImage, setReviewImage] = useState('');

console.log('storeData:', 2);

Expand All @@ -76,7 +77,7 @@ export default function ReviewWriteScreen(props) {
`${API_URL}/v1/restaurants/${storeData.id}/reviews`,
{
content: reviewContent,
imageUrls: reviewImage,
imageUrls: [reviewImage],
rating: rating,
},
{
Expand Down Expand Up @@ -122,10 +123,7 @@ export default function ReviewWriteScreen(props) {
console.log('response image:', response.data);

if (response.data.result === 'SUCCESS') {
setReviewImage(prevImages => [
...prevImages,
response.data.data[0].imageUrl,
]);
setReviewImage(response.data.data[0].imageUrl);
break;
}
count += 1;
Expand All @@ -139,29 +137,17 @@ export default function ReviewWriteScreen(props) {
}
};

const removeImage = index => {
setReviewImage(prevImages => prevImages.filter((_, i) => i !== index));
};

const DottedLine = () => {
return (
<View style={styles.dottedContainer}>
{[...Array(20)].map((_, index) => (
<View key={index} style={styles.dot} />
))}
</View>
);
};

return (
<>
<Header title={'리뷰 쓰기'} isBackButton={true} />
<View contentContainerStyle={styles.entire}>
<View style={styles.headerContainer}>
<Text style={styles.storeName}>{storeData.name}</Text>
<Text style={styles.storeName} numberOfLines={1}>
{storeData.name}
</Text>
<View style={styles.starContainer}>
{[...Array(5)].map((_, index) => (
<TouchableOpacity
<TouchableWithoutFeedback
key={index}
onPress={() => {
setRating(index + 1);
Expand All @@ -175,9 +161,9 @@ export default function ReviewWriteScreen(props) {
}
width="24"
height="24"
style={{marginLeft: 7}}
style={{marginLeft: 2}}
/>
</TouchableOpacity>
</TouchableWithoutFeedback>
))}
</View>
</View>
Expand All @@ -189,10 +175,10 @@ export default function ReviewWriteScreen(props) {
style={styles.photoButton}
onPress={() => {
console.log('리뷰 사진 추가', reviewImage);
if (reviewImage.length >= 3) {
console.log('Error: Maximum 3 images allowed');
return;
}
// if (reviewImage.) {
// console.log('Error: Maximum 3 images allowed');
// return;
// }
ImagePicker.openPicker({
width: 400,
height: 400,
Expand All @@ -206,8 +192,18 @@ export default function ReviewWriteScreen(props) {
console.error('Image Picker Error:', error);
});
}}>
<SvgXml xml={svgXml.icon.camera} width={24} height={24} />
<Text style={styles.photoButtonText}>사진 첨부하기</Text>
{reviewImage ? (
<View style={styles.imageWrapper}>
<Image source={{uri: reviewImage}} style={styles.image} />
<TouchableOpacity
style={styles.removeButton}
onPress={() => setReviewImage('')}>
<Text style={styles.removeButtonText}>X</Text>
</TouchableOpacity>
</View>
) : (
<SvgXml xml={svgXml.icon.reviewCamera} width={50} height={50} />
)}
</AnimatedButton>
{showImageError && (
<Text style={styles.errorText}>사진은 최대 3개만 넣어주세요</Text>
Expand All @@ -225,22 +221,7 @@ export default function ReviewWriteScreen(props) {
{showContentError && (
<Text style={styles.errorText}>리뷰 내용을 작성해주세요</Text>
)}
<DottedLine />
<ScrollView alwaysBounceHorizontal style={styles.imageScrollView}>
<View style={styles.imageContainer}>
{reviewImage.map((image, index) => (
<View key={index} style={styles.imageWrapper}>
<Image source={{uri: image}} style={styles.image} />
<TouchableOpacity
style={styles.removeButton}
onPress={() => removeImage(index)}>
<Text style={styles.removeButtonText}>X</Text>
</TouchableOpacity>
</View>
))}
</View>
</ScrollView>
<DottedLine />

<TouchableOpacity
style={styles.submitButton}
onPress={handleReviewSubmit}>
Expand All @@ -267,13 +248,17 @@ const styles = StyleSheet.create({
marginVertical: 20,
},
Container: {
width: '100%',
// width: '100%',
marginHorizontal: 16,
justifyContent: 'center',
alignItems: 'center',
},
storeName: {
fontSize: 22,
fontWeight: 'bold',
// fontWeight: 'bold',
fontFamily: 'NIXGONFONTS M 2.0',
color: COLOR_TEXT_BLACK,
maxWidth: (windowWidth * 3) / 5,
},
starContainer: {
flexDirection: 'row',
Expand All @@ -282,14 +267,15 @@ const styles = StyleSheet.create({
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: COLOR_WHITE,
borderColor: COLOR_PRIMARY,
borderWidth: 1,
backgroundColor: COLOR_LIGHTGRAY,
// borderColor: COLOR_PRIMARY,
// borderWidth: 1,
padding: 12,
borderRadius: 8,
marginTop: 6,
marginBottom: 16,
width: '92%',
marginBottom: 0,
width: 130,
height: 130,
},
photoButtonText: {
color: COLOR_PRIMARY,
Expand All @@ -305,12 +291,12 @@ const styles = StyleSheet.create({
},
imageWrapper: {
position: 'relative',
marginRight: 8,
// marginRight: 8,
},
image: {
width: 120,
height: 120,
borderRadius: 10,
width: 130,
height: 130,
borderRadius: 8,
},
removeButton: {
position: 'absolute',
Expand All @@ -330,7 +316,9 @@ const styles = StyleSheet.create({
borderWidth: 1,
borderRadius: 8,
padding: 12,
width: '92%',
fontFamily: 'NanumSquareRoundB',
// width: '92%',
// marginHorizontal: 16,
height: 160,
textAlignVertical: 'top',
marginVertical: 16,
Expand Down Expand Up @@ -367,7 +355,8 @@ const styles = StyleSheet.create({
},
submitButtonText: {
color: COLOR_WHITE,
fontFamily: 'NanumSquareRoundEB',
fontSize: 18,
fontWeight: '600',
// fontWeight: '600',
},
});
Loading

0 comments on commit cd26693

Please sign in to comment.