import { Image, ImageSourcePropType, StyleSheet, ImageStyle, Text, TouchableOpacity, View, ViewStyle, } from 'react-native'; import React from 'react'; import PlayyText from '../PlayyText/PlayyText'; import {ColorsScheme, useTheme} from '../../theme/ThemeContext'; import SwitchView from '../Switch/SwitchView'; interface ListCardProps { isLeftIcon?: boolean; leftIconName?: string; containerStyle?: ViewStyle; title?: string; rightIconName?: string; wrapperStyle?: ViewStyle; handlePressListCard?: () => void; subtitle?: string; tallList?: boolean; showImage?: boolean; imageContainerStyle?: ViewStyle; rightContainerStyle?: ViewStyle; imageSource?: ImageSourcePropType | undefined; showDetail?: boolean; detail?: string; titleColor?: string; subtitleColor?: string; detailColor?: string; isRightIcon?: boolean; righticonColor?: string; leftIconColor?: string; showToggle?: boolean; toggleValue?: boolean; onToggleChange?: (value: boolean) => void; thumbColor?: string; trackColorFalse?: string; trackColorTrue?: string; switchSize?: 'small' | 'medium' | 'large'; initial?: string; initialColor?: string; imageStyle?: ImageStyle | undefined; isButton?: boolean; buttonStyle?: ViewStyle; buttonText?: string; btnColor?: string; handleButtonPress?: () => void; } const ListCard: React.FC = ({ isLeftIcon, leftIconName, containerStyle, title, rightIconName, wrapperStyle, handlePressListCard, subtitle, tallList = false, showImage, imageContainerStyle, imageSource, showDetail, detail, titleColor, subtitleColor, detailColor, isRightIcon, righticonColor, leftIconColor, showToggle, toggleValue, onToggleChange, thumbColor, trackColorFalse, trackColorTrue, switchSize = 'medium', initial = '', initialColor, imageStyle, rightContainerStyle, isButton = false, buttonStyle, buttonText, btnColor, handleButtonPress, }) => { const {colors} = useTheme(); const styles = themedStyle(colors); const hasLeadingElement = showImage || isLeftIcon; return ( {isLeftIcon && ( {leftIconName} )} {!isLeftIcon && showImage && ( {imageSource ? ( ) : ( {initial} )} )} {title} {subtitle && ( {subtitle} )} {isButton && ( {buttonText} )} {showDetail && ( {detail} )} {isRightIcon && ( {rightIconName} )} {showToggle && ( )} ); }; export default ListCard; const themedStyle = (colors: ColorsScheme) => StyleSheet.create({ container: { // flex: 1,//:to be changed flexDirection: 'row', gap: 12, borderBottomWidth: 0, borderBottomColor: colors.separator_non_opaque, paddingLeft: 16, alignItems: 'center', }, iconContainer: { width: 32, alignItems: 'center', }, wrapperContainer: { flex: 1, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', borderBottomColor: colors.separator_non_opaque, }, left: { justifyContent: 'center', width: '88%', }, right: { flexDirection: 'row', alignItems: 'center', gap: 16, }, imageContainer: { width: 40, height: 40, borderRadius: 40, overflow: 'hidden', justifyContent: 'center', alignItems: 'center', }, image: { width: '100%', height: '100%', borderRadius: 40, }, button: { paddingVertical: 5, paddingHorizontal: 10, backgroundColor: colors.blue, borderRadius: 1000, alignItems: 'center', }, });