import React, {forwardRef, useImperativeHandle, useRef, useState} from "react"; import {…
- User
import React, {forwardRef, useImperativeHandle, useRef, useState} from "react"; import { ColorValue, DimensionValue, Keyboard, KeyboardTypeOptions, ReturnKeyTypeOptions, StyleProp, TextInput, TouchableOpacity, View, ViewStyle, } from "react-native";
import Icon from "@components/icon";
import Images from "@config/Images"; import {iComponentProps} from "@config/types/CommonInterface"; import {ComponentIdType} from "@config/types/CommonTypes";
import {useThemeAwareObject} from "@styles/theming/ThemingHelper"; import Typography from "@styles/Typography"; import {hp, wp} from "@utils/ResponsiveScreenUtil";
import Styles from "./Styles";
type OnChangeTextType = (id: string | number | null, text: string) => void; interface iTextInputProps extends iComponentProps { /** Id of an element / id?: ComponentIdType; /* Width of input / width?: DimensionValue | undefined; /* height of input / height?: DimensionValue | undefined; /* border effect of input when in focus / onFocusBorderColor?: string; /* border effect of input when in blur / onBlurBorderColor?: string; /* background color of the input / backgroundColor?: string; /* border width of the input / borderWidth?: number; /* editable (default : true) / editable?: boolean; /* container style / containerStyle?: StyleProp; /* secure entry text (default : false) / isSecure?: boolean; /* placeholder text / placeholder: string; /* placeholder text color / placeholderTextColor?: string; /* textinput text color / textColor?: string; /* textinput font size / fontSize?: number; /* keyBoard Type (default: 'default') / keyBoardType?: KeyboardTypeOptions; /* Callback function when pressed / onChangeText: OnChangeTextType; / value of the input field / value?: string; / max characters allowed in the input / maxLength?: number; / On Submit Editing / onSubmitEditing?: () => void; / Return Key Type Options */ returnKey?: ReturnKeyTypeOptions; multiline?: boolean | undefined; autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined; }
interface iTextInputRef { focus: () => void; }
// eslint-disable-next-line react/display-name const Input = forwardRef<iTextInputRef, iTextInputProps>( ( { id = null, width = "100%", height = hp(40), onFocusBorderColor = undefined, onBlurBorderColor = undefined, backgroundColor = undefined, borderWidth = 1.2, editable = true, containerStyle, isSecure = false, placeholder = "...", placeholderTextColor = undefined, textColor = undefined, fontSize = Typography.fontSizes.FONT_SIZE_17, keyBoardType = "default", onChangeText, value = "", maxLength, onSubmitEditing, returnKey = "default", multiline = false, autoCapitalize = "none", }, ref, ) => { const styles = useThemeAwareObject(Styles.createStyles);
- Assistant