import type { Animated, FlatListProps, StyleProp, TextStyle, ViewProps, ViewStyle, } from 'react-native'; /** * this type is written for range between 1-6 for size */ type Enumerate< N extends number, Acc extends number[] = [] > = Acc['length'] extends N ? Acc[number] : Enumerate; export type Range = Exclude< Enumerate, Enumerate >; /** * @property {number} selectedIndex - The index of the selected value * @property {Array} data - The data to be displayed in the wheel picker * @property {number} elementHeight - The height of each element in the wheel picker * @property {number} restElements - The number of elements to be displayed above and below the selected element * @property {string | number} decelerationRate - The deceleration rate of the scroll view * @property {number} loopCount - The number of times the data should be looped * @property {StyleProp} selectedLayoutStyle - The style of the selected element * @property {StyleProp} containerStyle - The style of the container * @property {ViewProps} containerProps - The props of the container * @property {FlatListProps} flatListProps - The props of the flat list * @property {StyleProp} elementTextStyle - The style of the element text * @property {StyleProp} elementContainerStyle - The style of the element container * @property {Animated.AnimatedAddition} currentScrollIndex - The current scroll index * @property {number} initialSelectedIndex - The initial selected index */ export interface WheelPickerProps extends Pick< Partial, | 'elementHeight' | 'elementContainerStyle' | 'restElements' | 'elementTextStyle' > { selectedIndex: number; data: Array; onChangeValue: (index: number, value: string) => void; selectedLayoutStyle?: StyleProp; containerStyle?: StyleProp; containerProps?: Omit; decelerationRate?: 'normal' | 'fast' | number; flatListProps?: Omit, 'data' | 'renderItem'>; loopCount?: number; infiniteScroll?: boolean; initialSelectedIndex?: number; } /** * @property {string | null} item - The item to be displayed in the wheel picker element * @property {number} elementHeight - The height of the element * @property {number} index - The index of the element * @property {Animated.AnimatedAddition} currentScrollIndex - The current scroll index * @property {Range<1, 6>} restElements - The number of elements to be displayed above and below the selected element * @property {number} defaultActiveScale - The default scale of the active element * @property {number} defaultActiveOpacity - The default opacity of the active element * @property {StyleProp} elementTextStyle - The style of the element text * @property {StyleProp} elementContainerStyle - The style of the element container */ export interface WheelPickerElementProps { item: string | null; elementHeight: number; index: number; currentScrollIndex: Animated.AnimatedAddition; restElements: Range<1, 6>; defaultActiveScale?: number; defaultActiveOpacity?: number; elementTextStyle: StyleProp; elementContainerStyle: StyleProp; } /** * @property {(index: number) => void} scrollToIndex - The function to scroll to a specific index */ export interface WheelPickerRef { scrollToIndex: (index: number) => void; }