From f79285687ca77ab376374a2864ae3911f3db5dd6 Mon Sep 17 00:00:00 2001 From: sjsjmine129 Date: Sat, 1 Jun 2024 18:27:56 +0900 Subject: [PATCH] Fix --- src/components/StoreCompoForR.js | 63 ++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/src/components/StoreCompoForR.js b/src/components/StoreCompoForR.js index 4b00f2b..a70cea4 100644 --- a/src/components/StoreCompoForR.js +++ b/src/components/StoreCompoForR.js @@ -1,10 +1,18 @@ /* eslint-disable react-native/no-inline-styles */ import React, {useState, useContext, useEffect} from 'react'; -import {View, Text, StyleSheet, Pressable, ScrollView} from 'react-native'; +import { + View, + Text, + StyleSheet, + Pressable, + ScrollView, + Image, +} from 'react-native'; import { COLOR_TEXT70GRAY, COLOR_TEXT_BLACK, COLOR_TEXT60GRAY, + COLOR_BACKGROUND, } from '../assets/color'; import {useNavigation} from '@react-navigation/native'; import {Dimensions} from 'react-native'; @@ -24,6 +32,9 @@ export default function StoreCompoForR(props) { const {storeData, index} = props; const [storeInfo, setStoreInfo] = useState([]); + const [naverRatingAvg, setNaverRatingAvg] = useState(0); + + const [score, setScore] = useState(0); const restaurantDetail = async () => { console.log('Id: ', storeData.restaurantId); @@ -37,6 +48,8 @@ export default function StoreCompoForR(props) { console.log('Restaurant heart:', response.data.data.restaurant); setStoreInfo(response.data.data.restaurant); + setScore(response.data.data.restaurant.ratingAvg); + setNaverRatingAvg(response.data.data.restaurant.naverRatingAvg); } catch (error) { console.error('Error fetching restaurant details:', error); } @@ -61,12 +74,21 @@ export default function StoreCompoForR(props) { }}> + + + {storeData.image ? ( - ) : ( - - {storeInfo.ratingAvg.toFixed(1)} ({storeInfo.reviewCount}) + {score.toFixed(1)} ({storeInfo.reviewCount}) {storeInfo.likeCount} + + + {naverRatingAvg.toFixed(1) + + ' (' + + storeInfo.naverReviewCount + + ')'} + {storeData.firstReview.reviewer + '님'}