11import React from 'react' ;
2- import { View , Text , StyleSheet } from 'react-native' ;
2+ import { View , Text , StyleSheet , Pressable } from 'react-native' ;
33import Toast from 'react-native-toast-message' ;
44import { AppDispatch } from '../reduxApp' ;
55import { StyledButton } from './StyledButton' ;
@@ -12,6 +12,8 @@ export const StyledProductCard = (props: {
1212 price : number ;
1313 title : string ;
1414 imgcropped : string ;
15+ description : string ;
16+ onPress : ( ) => void ;
1517 appDispatch : AppDispatch ;
1618} ) : React . ReactElement => {
1719 const onAddToCartPressed = ( ) => {
@@ -25,20 +27,22 @@ export const StyledProductCard = (props: {
2527 imgcropped : props . imgcropped ,
2628 } ,
2729 } ) ;
30+ const visibilityTimeMs = 1000 ;
2831 Toast . show ( {
2932 type : 'success' ,
3033 position : 'bottom' ,
3134 text1 : 'Added to Cart' ,
32- visibilityTime : 0.5 ,
35+ visibilityTime : visibilityTimeMs ,
3336 } ) ;
3437 } ;
3538
3639 return (
37- < View style = { styles . cardContainer } >
40+ < Pressable style = { styles . cardContainer } onPress = { props . onPress } >
3841 < View style = { styles . cardHero } > { selectImage ( props . imgcropped ) } </ View >
3942 < View style = { styles . cardDetail } >
4043 < View style = { styles . cardDetailContent } >
4144 < Text style = { styles . cardTitle } > { props . title } </ Text >
45+ < Text style = { styles . cardDescription } > { props . description } </ Text >
4246 < Text style = { styles . itemPrice } > ${ props . price } </ Text >
4347 </ View >
4448 < View style = { styles . cardDetailAction } >
@@ -52,7 +56,7 @@ export const StyledProductCard = (props: {
5256 />
5357 </ View >
5458 </ View >
55- </ View >
59+ </ Pressable >
5660 ) ;
5761} ;
5862
@@ -111,4 +115,7 @@ const styles = StyleSheet.create({
111115 addToCartButtonDefault : {
112116 margin : 10 ,
113117 } ,
118+ cardDescription : {
119+ fontSize : 14 ,
120+ } ,
114121} ) ;
0 commit comments