import React from 'react'; import { Pressable, StyleSheet, View, Text, StyleProp, ViewStyle } from 'react-native'; import { useTheme } from '../../theme'; import { CustomIcon } from '../CustomIcon'; import sharedStyles from '../../views/Styles'; import Avatar from '../Avatar'; const styles = StyleSheet.create({ pressable: { paddingHorizontal: 8, marginRight: 8, borderRadius: 2, justifyContent: 'center', maxWidth: 192 }, container: { flexDirection: 'row', alignItems: 'center' }, avatar: { marginRight: 8, marginVertical: 8 }, textContainer: { marginRight: 8, maxWidth: 120 }, name: { fontSize: 16, ...sharedStyles.textMedium } }); export interface IChip { avatar?: string; text: string; onPress?: Function; testID?: string; style?: StyleProp; } const Chip = ({ avatar, text, onPress, testID, style }: IChip) => { const { colors } = useTheme(); return ( [ styles.pressable, { backgroundColor: pressed ? colors.bannerBackground : colors.auxiliaryBackground }, style ]} disabled={!onPress} onPress={() => onPress?.()} android_ripple={{ color: colors.bannerBackground }} > {avatar ? : null} {text} {onPress ? : null} ); }; export default Chip;