import React from 'react'; import { type StyleProp, StyleSheet, type TextStyle, TouchableOpacity, type ViewStyle, } from 'react-native'; import { moderateScale } from 'react-native-size-matters'; import { defaultScale } from '../../utils/Common'; import TTypography from '../TTypography/TTypography'; import { TypographyVariant } from '../TTypography/TTypographyEnum'; import { withTheme, useTheme } from '../../core/theming'; import type { Theme } from '../../utils/types'; import IconSVG from '../../assets/svgs'; interface Props { onPress: () => void; onPressRightIcon?: () => void; onPressLeftIcon?: () => void; viewStyle?: StyleProp; textStyle?: StyleProp; label: string; selectedBackgroundColor?: string; selectedTextColor?: string; textColor?: string; isDisabled?: boolean; iconHeight?: number; iconWidth?: number; rightIcon?: any; leftIcon?: any; isSelected?: boolean; theme: Theme; } const defaultSize = 20; const TChip: React.FC = ({ label, onPress, onPressRightIcon, onPressLeftIcon, selectedBackgroundColor, selectedTextColor, textColor, iconHeight = defaultSize, iconWidth = defaultSize, rightIcon, leftIcon, isDisabled = false, textStyle = { paddingHorizontal: moderateScale(12, defaultScale), paddingVertical: moderateScale(4, defaultScale), fontSize: moderateScale(14, defaultScale), lineHeight: moderateScale(21, defaultScale), }, isSelected = false, }): any => { const handleChip = () => { if (isDisabled) { return; } onPress(); }; const { colors } = useTheme(); const bgColor = selectedBackgroundColor ? selectedBackgroundColor : colors.primaryButtonColor; return ( ); }; const styles = StyleSheet.create({ viewStyle: { flexDirection: 'row', alignItems: 'center', borderWidth: moderateScale(1, defaultScale), borderRadius: moderateScale(4, defaultScale), alignSelf: 'center', }, }); export default withTheme(TChip);