import React from "react"; import { DatePickerInput, DatePickerInputProps } from "@mantine/dates"; import { useController, FieldValues, UseControllerProps, } from "react-hook-form"; type Props = DatePickerInputProps & { name: UseControllerProps["name"]; rules?: UseControllerProps["rules"]; defaultValue?: UseControllerProps["defaultValue"]; }; function RHFDatePickerInput( props: Props ) { const { name, rules, defaultValue, ...others } = props; const { field, fieldState: { error }, } = useController({ name, rules }); return ( field.onChange(value)} /> ); } export default RHFDatePickerInput; export const createDatePickerField = () => { const Field = (props: Props) => ; return Field; };