import React from 'react'; import { View, Text, StyleSheet, Image, TouchableOpacity } from 'react-native'; import DropdownSelectedItemsContainer, { DropdownSelectedItemsContainerProps, } from './DropdownSelectedItemsContainer'; import { colors } from '../../styles/colors'; import { typography } from '../../styles/typography'; import { TDropdownInputProps } from '../../types/index.types'; const Dropdown = ({ testID, label, placeholder, helperText, error, selectionData, openModal, isMultiple, selectedItem, selectedItems, optionLabel, optionValue, selectedItemsControls, dropdownIcon, labelStyle, dropdownStyle, dropdownIconStyle, dropdownContainerStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, primaryColor, disabled, setIndexOfSelectedItem, handleMultipleSelections, }: TDropdownInputProps & DropdownSelectedItemsContainerProps) => { return ( {label && label !== '' && ( {label} )} {error && error !== '' && ( {error} )} {helperText && helperText !== '' && !error && ( {helperText} )} {/* Trailing Icon */} openModal()} testID="dropdown-trailing-icon" > {dropdownIcon || ( )} ); }; const styles = StyleSheet.create({ label: { marginBottom: 16, color: colors.gray, ...typography.caption }, error: { color: colors.red, marginTop: 8, ...typography.caption }, helper: { marginTop: 8, color: colors.primary, ...typography.caption }, dropdownInputContainer: { marginBottom: 23, width: '100%' }, blackText: { color: colors.black }, iconStyle: { position: 'absolute', right: 25, top: 60 }, }); export default Dropdown;