UNPKG

@ant-design/react-native

Version:

基于蚂蚁金服移动设计规范的 React Native 组件库

38 lines (37 loc) 1.32 kB
import { TouchableHighlightProps } from 'react-native'; import { InputProps } from '../input/PropsType'; import { Theme } from '../style'; import { StepperStyle } from './style'; type ValueProps<ValueType> = { allowEmpty: true; value?: ValueType | null; defaultValue?: ValueType | null; onChange?: (value: ValueType | null) => void; }; type ValuePropsWithNull<ValueType> = { allowEmpty?: false; value?: ValueType; defaultValue?: ValueType; onChange?: (value: ValueType) => void; }; export type BaseStepperProps<ValueType> = Omit<InputProps, 'value' | 'defaultValue' | 'onChange' | 'styles'> & (ValuePropsWithNull<ValueType> | ValueProps<ValueType>) & { min?: ValueType; max?: ValueType; step?: ValueType; digits?: number; disabled?: boolean; minusButtonProps?: TouchableHighlightProps; plusButtonProps?: TouchableHighlightProps; parser?: (text: string) => ValueType; formatter?: (value?: ValueType) => string; styles?: Partial<StepperStyle>; themeStyles?: (theme: Theme) => Partial<StepperStyle>; }; type NumberStepperProps = BaseStepperProps<number> & { stringMode?: false; }; type StringStepperProps = BaseStepperProps<string> & { stringMode: true; }; export type StepperProps = NumberStepperProps | StringStepperProps; export {};