rc-simple-hook-form
Version:
## Overview
40 lines (39 loc) • 1.26 kB
TypeScript
import React from "react";
import { useForm } from "..";
import { EventElement, InputType, ValidationFields } from "../types/package";
type RenderProp = {
field: {
value: any;
checked: any;
multiple: boolean | undefined;
disabled: boolean | undefined;
name: string;
type: InputType;
onBlur: (e: React.FocusEvent<EventElement, Element>) => void;
onChange: (e: React.ChangeEvent<EventElement>) => void;
onFocus: (e: React.FocusEvent<EventElement, Element>) => void;
};
fieldState: {
isTouched: boolean;
isDirty: boolean;
invalid: boolean;
isActive: boolean;
isEmpty: boolean;
error: string[];
};
};
type ControllerProps = {
name: string;
type: InputType;
control: ReturnType<typeof useForm>["control"];
initialValue?: unknown;
rules?: ValidationFields;
disabled?: boolean;
runValidationWhenChangesIn?: string[];
controllerRef?: React.MutableRefObject<EventElement | null>;
radioFieldValue?: string;
checkboxFieldValue?: string;
render: (arg: RenderProp) => React.JSX.Element;
};
declare function Controller(props: ControllerProps): React.JSX.Element;
export default Controller;