Interface UseFormManagerReturn<TFormValues>

interface UseFormManagerReturn<TFormValues> {
    formState: FormState<TFormValues>;
    getInputProps: ((name: keyof TFormValues) => {
        onBlur?: (() => void);
        onChangeText: ((text: string) => void);
        onFocus?: (() => void);
        onSubmitEditing?: (() => void);
        value: TFormValues[keyof TFormValues];
    });
    handleChange: ((input: {
        name: keyof TFormValues;
        value: TFormValues[keyof TFormValues];
    }) => void);
    handleSubmit: (() => void);
    resetForm: (() => void);
    setFormErrors: ((errors: Partial<Record<keyof TFormValues, string>>) => void);
}

Type Parameters

  • TFormValues

Properties

Current form state, including values and errors

getInputProps: ((name: keyof TFormValues) => {
    onBlur?: (() => void);
    onChangeText: ((text: string) => void);
    onFocus?: (() => void);
    onSubmitEditing?: (() => void);
    value: TFormValues[keyof TFormValues];
})

Provides standardized props for TextInput components

handleChange: ((input: {
    name: keyof TFormValues;
    value: TFormValues[keyof TFormValues];
}) => void)

Handler for updating a form field

handleSubmit: (() => void)

Submits the form after validation

resetForm: (() => void)

Resets the form to its initial values

setFormErrors: ((errors: Partial<Record<keyof TFormValues, string>>) => void)

Sets custom error messages for fields