11import { useLocalSearchParams } from 'expo-router' ;
2- import { Alert , Button , ScrollView , Share , StyleSheet , Text , View } from 'react-native' ;
2+ import { Alert , Pressable , ScrollView , Share , StyleSheet , Text , View } from 'react-native' ;
33
44import CustomSafeAreaView from '@/components/CustomSafeAreaView' ;
55import { Image } from 'expo-image' ;
66import Ionicons from '@expo/vector-icons/Ionicons' ;
77import { useEffect , useState } from 'react' ;
88import { fetchTrend , Trend } from '@/utils/trendApi' ;
9+ import SectionHeader from '@/components/SectionHeader' ;
10+ import { Colors } from '@/constants/Colors' ;
911
1012export default function TrendDetail ( ) {
1113 const { trendId } = useLocalSearchParams ( ) ;
@@ -23,7 +25,7 @@ export default function TrendDetail() {
2325 } ) ;
2426 } , [ trendId ] ) ;
2527
26- const onShare = async ( ) => {
28+ const handleShare = async ( ) => {
2729 try {
2830 const result = await Share . share ( {
2931 message : `Check out this trend!
@@ -50,25 +52,45 @@ _found with GetDressed ✨_`,
5052
5153 return (
5254 < CustomSafeAreaView style = { styles . container } >
53- < ScrollView >
55+ < SectionHeader title = { trend ?. trendTitle || 'Aktueller Trend' } />
56+ < Pressable onPress = { handleShare } style = { styles . floatingShare } >
57+ < Ionicons name = "share" size = { 24 } style = { styles . floatingText } />
58+ </ Pressable >
59+ < ScrollView style = { styles . scrollContainer } showsVerticalScrollIndicator = { false } >
5460 < View style = { { marginBottom : 24 } } >
61+ < Image source = { trend ?. trendImage } style = { styles . image } />
5562 < Text style = { styles . title } > Aktueller Trend:</ Text >
5663 < Text style = { styles . title } > { trend ?. trendTitle } </ Text >
57- < Image source = { trend ?. trendImage } style = { styles . image } />
5864 </ View >
5965 < View style = { { marginBottom : 24 } } >
60- < Text style = { styles . title } > Hype auf Instagram</ Text >
6166 < Text style = { styles . text } > { trend ?. trendDescription } </ Text >
6267 </ View >
6368 < View style = { { marginBottom : 24 } } >
6469 < Text style = { styles . text } > found on:</ Text >
6570 < View style = { { flexDirection : 'row' } } >
66- < Ionicons style = { styles . socialIcon } name = "logo-instagram" size = { 24 } color = "#999" />
67- < Ionicons style = { styles . socialIcon } name = "logo-pinterest" size = { 24 } color = "#999" />
68- < Ionicons style = { styles . socialIcon } name = "logo-twitter" size = { 24 } color = "#999" />
71+ { trend ?. trendSources ?. map ( ( source ) => {
72+ // Map known sources to valid Ionicons names
73+ const iconMap : { [ key : string ] : keyof typeof Ionicons . glyphMap } = {
74+ Instagram : 'logo-instagram' ,
75+ Facebook : 'logo-facebook' ,
76+ Twitter : 'logo-twitter' ,
77+ TikTok : 'logo-tiktok' ,
78+ Pinterest : 'logo-pinterest' ,
79+ // add more mappings as needed
80+ } ;
81+ const iconName = iconMap [ source ] || 'help' ;
82+ return (
83+ < Ionicons
84+ style = { styles . socialIcon }
85+ name = { iconName }
86+ size = { 24 }
87+ color = "#999"
88+ key = { source }
89+ />
90+ ) ;
91+ } ) }
6992 </ View >
7093 </ View >
71- < Button onPress = { onShare } title = "Share" />
7294 </ ScrollView >
7395 </ CustomSafeAreaView >
7496 ) ;
@@ -77,10 +99,12 @@ _found with GetDressed ✨_`,
7799const styles = StyleSheet . create ( {
78100 container : {
79101 flex : 1 ,
80- paddingTop : 32 ,
81- paddingHorizontal : 16 ,
82102 backgroundColor : '#fff' ,
83103 } ,
104+ scrollContainer : {
105+ marginTop : 24 ,
106+ paddingHorizontal : 16 ,
107+ } ,
84108 title : {
85109 fontSize : 22 ,
86110 fontWeight : 'bold' ,
@@ -92,10 +116,24 @@ const styles = StyleSheet.create({
92116 } ,
93117 text : {
94118 marginBottom : 16 ,
95- fontWeight : 'bold' ,
96119 color : '#999' ,
97120 } ,
98121 socialIcon : {
99122 marginRight : 16 ,
100123 } ,
124+ floatingShare : {
125+ position : 'absolute' ,
126+ zIndex : 100 ,
127+ right : 16 ,
128+ bottom : 22 ,
129+ width : 50 ,
130+ height : 50 ,
131+ backgroundColor : Colors . light . shareButton ,
132+ borderRadius : 25 ,
133+ justifyContent : 'center' ,
134+ alignItems : 'center' ,
135+ } ,
136+ floatingText : {
137+ color : '#fff' ,
138+ } ,
101139} ) ;
0 commit comments