import type { ReactElement } from 'react'; import type { ListRenderItemInfo, SectionListData, SectionListRenderItemInfo, StyleProp, ViewStyle } from 'react-native'; import type { BottomSheetProps } from '../BottomSheet'; import type { TextInputProps } from '../TextInput'; export type SelectOptionType = { value: V; text: string; key?: string; disabled?: boolean; highlighted?: boolean; }; export type SectionType = { category: string; }; export type SectionData> = SectionListData; export type CombinedOptionsType> = T[] | SectionData[]; export type ListRenderOptionInfo> = ListRenderItemInfo & { selected: boolean; onPress: () => void; }; export type SectionListRenderOptionInfo> = SectionListRenderItemInfo & { selected: boolean; onPress: () => void; }; export interface SelectProps> extends Pick { /** * An array of options to be selected. */ options: CombinedOptionsType; /** * Customize option renderer. */ renderOption?: ((info: ListRenderOptionInfo) => ReactElement) | ((info: SectionListRenderOptionInfo) => ReactElement); /** * Used to extract a unique key for a given option at the specified index. Key is used for caching and as the react key to track item re-ordering. * The default extractor checks option.key, and then falls back to using the index, like React does. */ keyExtractor?: (option: T, index?: number) => string; /** * Current search value. */ query?: string; /** * Search bar onChangeText event handler */ onQueryChange?: (value: string) => void; /** * Event handler when selection dismiss */ onDismiss?: () => void; /** * Event handler when end of the list reached */ onEndReached?: () => void; /** * Show loading indicator at bottom of option list */ loading?: boolean; /** * Props that are passed to TextInput. * Required is deprecated and will be removed in the next major release. * Please use the outer required instead. */ inputProps?: Pick; /** * Field label. */ label: string; /** * Additional style. */ style?: StyleProp; /** * Testing id of the component. */ testID?: string; /** * Config for the bottom sheet. */ bottomSheetConfig?: { variant?: BottomSheetProps['variant']; header?: BottomSheetProps['header']; }; /** * Inject a custom TextInput component (e.g., from rn-work-uikit). Defaults to local TextInput. */ TextInputComponent?: React.ComponentType; }