import * as React from 'react'; import { TextInput, ViewStyle, TextStyle, View } from 'react-native'; import { getColor } from './style-utils'; import { SmallDotIcon } from './icons/small-dot'; import Text from './text'; interface LabelProps { value?: string; placeholder?: string; textColor?: string; placeholderColor?: string; textStyle?: TextStyle; labelClassName?: string; disabled?: boolean; onChangeText?: (text: string) => void; onFocus?: () => void; onBlur?: () => void; className?: string; style?: ViewStyle; secureTextEntry?: boolean; maxLength?: number; keyboardType?: 'default' | 'numeric' | 'email-address'; editable?: boolean; isLabelOnly?: boolean; required?: boolean; characterCount?: boolean; maxCharacterCount?: number; } const Label = React.forwardRef( ( { value, placeholder, textColor = '', placeholderColor = 'gray', textStyle, disabled = false, onChangeText, onFocus, onBlur, className = 'flex-1 px-4 pr-12 h-full', style, secureTextEntry, maxLength, keyboardType = 'default', editable = true, isLabelOnly = false, required = false, labelClassName, characterCount = false, maxCharacterCount = 0, }, ref, ) => { if (isLabelOnly) { return ( {value && ( {value} )} {required && ( )} ); } return ( <> {characterCount ? ( {value && ( {value ? value.length : 0} )} {'/'} {maxCharacterCount && ( {maxCharacterCount} )} ) : ( )} ); }, ); export default Label;