UNPKG

@janiscommerce/ui-native

Version:
27 lines (26 loc) 1.03 kB
import React from 'react'; import { TextInput } from 'react-native'; import { BaseInputProps } from '../../atoms/BaseInput'; export type InputVariant = 'default' | 'weightable' | 'amountTotal' | 'currency' | 'numeric'; interface BaseInputPropsExtended extends BaseInputProps { type?: 'currency' | 'number' | 'text' | 'email' | 'phone'; variant?: InputVariant; onChangeText?: (text: string) => void; totalValue?: number; } type AmountTotalProps = BaseInputPropsExtended & { variant: 'amountTotal'; totalValue: number; }; type OtherVariantProps = BaseInputPropsExtended & { variant: Exclude<InputVariant, 'amountTotal'>; totalValue?: never; }; type DefaultProps = BaseInputPropsExtended & { variant?: never; type: 'currency' | 'number' | 'text' | 'email' | 'phone'; totalValue?: never; }; export type InputProps = AmountTotalProps | OtherVariantProps | DefaultProps; declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<TextInput>>; export default Input;