
import React from 'react';
import {View, Image, Text, StyleSheet,TouchableOpacity} from 'react-native'
import {firebase_db} from "../firebaseConfig"
const isIOS = Platform.OS === 'ios';
import * as Application from 'expo-application';
//MainPage로 부터 navigation 속성을 전달받아 Card 컴포넌트 안에서 사용
export default function LikeCard({content,navigation,tip, setTip}){
//MainPage로 부터 navigation 속성을 전달받아 Card 컴포넌트 안에서 사용
const detail = () => {
navigation.navigate('DetailPage',{idx:content.idx})
}
const remove = async (삭제찜카드) => {
let userUniqueId;
if(isIOS){
let iosId = await Application.getIosIdForVendorAsync();
userUniqueId = iosId
}else{
userUniqueId = await Application.androidId
}
console.log(userUniqueId)
firebase_db.ref('/like/'+userUniqueId+'/'+삭제찜카드).remove().then(function(){
Alert.alert("삭제 완료!");
let result = tip.filter((data,i)=>{
return data.idx !== 삭제찜카드
console.log(result)
setTip(result)
})
}
return(
<View style={styles.card}>
<Image style={styles.cardImage} source={{uri:content.image}}/>
<View style={styles.cardText}>
<Text style={styles.cardTitle} numberOfLines={1}>{content.title}</Text>
<Text style={styles.cardDesc} numberOfLines={3}>{content.desc}</Text>
<Text style={styles.cardDate}>{content.date}</Text>
<View style={styles.buttonGroup}>
<TouchableOpacity style={styles.button} onPress={()=>detail()}><Text style={styles.buttonText}>자세히 보기</Text></TouchableOpacity>
<TouchableOpacity style={styles.button} onPress={()=>remove()}><Text style={styles.buttonText}>찜 해제</Text></TouchableOpacity>
</View>
</View>
</View>
)
에러메세지
Android Bundling failed 689ms
SyntaxError: C:\Users\vit01\OneDrive\바탕 화면\스파르타스터디\sparta-myhoneytip-jung\components\LikeCard.js: Unexpected token, expected "," (37:6)
35 | }
36 |
> 37 | return(
| ^
38 |
39 | <View style={styles.card}>
40 | <Image style={styles.cardImage} source={{uri:content.image}}/>
