import React from 'react'; import { TouchableOpacity, View, StyleSheet, ImageStyle, StyleProp, } from 'react-native'; import Image from '../Image'; import { ImageProps } from '../Image/interface'; import { renderHighLightTextLikeJSX } from '../../core/helpers'; import { IconXRightsmall1 } from '../../icons'; import { Option, SelectProps } from './interface'; import createStyles from './styles/FlatSelect.style'; import { useTheme } from '../Theme'; import ShouldRender from '../ShouldRender'; type StylesType = ReturnType; const RedirectItem = React.memo( ({ option, testID, currencySelectProps, onDisabledPress, onChangeFn, searchValue, styles, rowHeight, }: { option: Option; testID: string; itemFullContainer: boolean; currencySelectProps?: SelectProps['currencySelectProps']; onDisabledPress?: (option: Option) => void; onChangeFn: (values: string | string[]) => void; searchValue: string; styles: StylesType; rowHeight?: number; }) => { const token = useTheme(); return ( { if (option?.disabled) { onDisabledPress?.(option); return; } onChangeFn(option.value); }} style={StyleSheet.flatten([ styles.itemContainer, typeof rowHeight === 'number' && rowHeight > 0 ? { height: rowHeight } : undefined, ])} > , option.disabled && styles.disabled_img, ])} /> {option.prefixIcon} {renderHighLightTextLikeJSX( option.label, StyleSheet.flatten([ styles.label, option.disabled && styles.labelDisabled, ]), searchValue, { numberOfLines: option.subLabel ? 1 : 2, ellipsizeMode: 'tail', } )} {renderHighLightTextLikeJSX( option.subLabel, StyleSheet.flatten([ styles.subLabel, option.disabled && styles.subLabelDisabled, ]), searchValue, { numberOfLines: 2, ellipsizeMode: 'tail', } )} {renderHighLightTextLikeJSX( option.contentLabel, StyleSheet.flatten([ styles.contenLabel, option.disabled && styles.contentLabelDisabled, ]), searchValue )} ); } ); export default RedirectItem;