UNPKG

@monchilin/react-native-dropdown

Version:
73 lines (72 loc) 3.15 kB
import { FlatListProps, ModalProps, StyleProp, TextProps, TextStyle, TouchableHighlightProps, TouchableNativeFeedbackProps, TouchableOpacityProps, TouchableWithoutFeedbackProps, ViewProps, ViewStyle } from 'react-native'; export declare type Position = { width?: number; height: number; top: number; left?: number; right?: number; }; export declare type Animations = { transitionShow: 'flipUp' | 'scaleIn' | 'fadeIn' | 'slideUp'; transitionHide: 'flipDown' | 'scaleOut' | 'fadeOut' | 'slideDown'; }; export declare type UsePositionProps = { heightSourceStyle: StyleProp<ViewStyle>[]; widthSourceStyle: StyleProp<ViewStyle>[]; }; export declare type UseAnimationPropsMeta = { dropdownWidth: number; dropdownHeight: number; }; export declare type UseAnimationProps = { visible: boolean; transitionShow: Animations['transitionShow']; transitionHide: Animations['transitionHide']; meta: UseAnimationPropsMeta; }; export declare type Props<ItemT> = { defaultIndex?: number; defaultLabel?: string; index?: number; onSelect?: (index: number, item?: ItemT) => boolean | void | undefined; dataSource: ReadonlyArray<ItemT>; disabled?: boolean; loading?: boolean; animated?: boolean; transitionShow?: Animations['transitionShow']; transitionHide?: Animations['transitionHide']; scrollEnabled?: boolean; keyExtractor?: (item: ItemT, index: number) => string; adjustFrame?: (position: Position) => Position; renderItem?: (item: ItemT, index: number, isActive: boolean) => JSX.Element; renderSeparator?: (separator: { highlighted: string; leadingItem: ItemT; }) => JSX.Element | null; showSeparator?: boolean; renderLabel?: (item?: ItemT, index?: number) => string; onDropdownWillShow?: (item: ItemT, index: number) => boolean | void; onDropdownWillHide?: (item: ItemT, index: number) => boolean | void; rootContainerStyle?: StyleProp<ViewStyle>; rootContainerProps?: Omit<ViewProps, 'style'>; labelContainerDisabledStyle?: StyleProp<ViewStyle>; labelContainerStyle?: StyleProp<ViewStyle>; labelContainerProps?: Omit<TouchableOpacityProps, 'ref' | 'disabled' | 'onPress'>; labelStyle?: StyleProp<TextStyle>; labelDisabledStyle?: StyleProp<TextStyle>; labelProps?: Omit<TextProps, 'style'>; modalProps?: Omit<ModalProps, 'visible' | 'animated' | 'transparent' | 'onRequestClose'>; dropdownStyle?: StyleProp<ViewStyle>; dropdownProps?: Omit<FlatListProps<ItemT>, 'data' | 'style' | 'scrollEnabled' | 'renderItem' | 'ItemSeparatorComponent' | 'keyExtractor'>; itemTouchableProps?: Omit<TouchableOpacityProps | TouchableHighlightProps | TouchableNativeFeedbackProps | TouchableWithoutFeedbackProps, 'onPress'>; itemLabelStyle?: StyleProp<TextStyle>; itemLabelProps?: Omit<TextProps, 'style'>; itemHighlightStyle?: StyleProp<ViewStyle>; itemLabelHighlightStyle?: StyleProp<TextStyle>; children?: JSX.Element | JSX.Element[]; }; export declare type Handles = { select: (index: number) => void; hide: () => void; show: () => void; };