UNPKG

react-native-element-dropdown

Version:

React Native Element Dropdown is a library that provides a customizable dropdown component for React Native applications.

75 lines (72 loc) 2.19 kB
import type React from 'react'; import type { StyleProp, TextStyle, ViewStyle, TextProps, ImageStyle, FlatListProps, } from 'react-native'; export type IDropdownRef = { open: () => void; close: () => void; }; export interface DropdownProps<T> { ref?: | React.RefObject<IDropdownRef> | React.MutableRefObject<IDropdownRef> | null | undefined; testID?: string; itemTestIDField?: string; style?: StyleProp<ViewStyle>; containerStyle?: StyleProp<ViewStyle>; placeholderStyle?: StyleProp<TextStyle>; selectedTextStyle?: StyleProp<TextStyle>; selectedTextProps?: TextProps; itemContainerStyle?: StyleProp<ViewStyle>; itemTextStyle?: StyleProp<TextStyle>; inputSearchStyle?: StyleProp<TextStyle>; iconStyle?: StyleProp<ImageStyle>; maxHeight?: number; minHeight?: number; fontFamily?: string; iconColor?: string; activeColor?: string; data: T[]; value?: T | string | null | undefined; placeholder?: string; labelField: keyof T; valueField: keyof T; searchField?: keyof T; search?: boolean; searchPlaceholder?: string; searchPlaceholderTextColor?: string; disable?: boolean; autoScroll?: boolean; showsVerticalScrollIndicator?: boolean; dropdownPosition?: 'auto' | 'top' | 'bottom'; flatListProps?: Omit<FlatListProps<any>, 'renderItem' | 'data'>; keyboardAvoiding?: boolean; backgroundColor?: string; confirmSelectItem?: boolean; accessibilityLabel?: string; itemAccessibilityLabelField?: string; inverted?: boolean; mode?: 'default' | 'modal' | 'auto'; closeModalWhenSelectedItem?: boolean; excludeItems?: T[]; excludeSearchItems?: T[]; onChange: (item: T) => void; renderLeftIcon?: (visible?: boolean) => React.ReactElement | null; renderRightIcon?: (visible?: boolean) => React.ReactElement | null; renderItem?: (item: T, selected?: boolean) => React.ReactElement | null; renderInputSearch?: ( onSearch: (text: string) => void ) => React.ReactElement | null; onFocus?: () => void; onBlur?: () => void; searchQuery?: (keyword: string, labelValue: string) => boolean; onChangeText?: (search: string) => void; onConfirmSelectItem?: (item: T) => void; }