react-hook-form
Advanced tools
Comparing version 0.4.0-beta.5 to 0.4.0-beta.6
declare type Validate = (data: string | number) => boolean | string | number | Date; | ||
declare type NumberOrString = number | string; | ||
declare type Props = { | ||
mode: 'onSubmit' | 'onBlur' | 'onChange'; | ||
validationSchema?: any; | ||
}; | ||
export interface RegisterInput { | ||
@@ -46,3 +50,2 @@ ref: HTMLInputElement | HTMLSelectElement | null; | ||
} | ||
declare type ValidationSchema = any; | ||
export interface ErrorMessages { | ||
@@ -53,6 +56,3 @@ [key: string]: { | ||
} | ||
export default function useForm({ mode, validationSchema }?: { | ||
mode: 'onSubmit' | 'onBlur' | 'onChange'; | ||
validationSchema?: ValidationSchema; | ||
}): { | ||
export default function useForm({ mode, validationSchema }?: Props): { | ||
register: (data: RegisterInput) => void; | ||
@@ -59,0 +59,0 @@ handleSubmit: (callback: (Object: any, e: any) => void) => (e: any) => Promise<void>; |
@@ -236,3 +236,2 @@ import { useRef, useState, useEffect } from 'react'; | ||
catch (e) { | ||
console.log('yup error', e); | ||
return parseErrorSchema(e); | ||
@@ -341,4 +340,2 @@ } | ||
localErrors = await validateWithSchema(validationSchema, values); | ||
console.log(values); | ||
console.log(localErrors); | ||
if (localErrors === undefined) { | ||
@@ -345,0 +342,0 @@ callback(values, e); |
@@ -238,3 +238,2 @@ 'use strict'; | ||
catch (e) { | ||
console.log('yup error', e); | ||
return parseErrorSchema(e); | ||
@@ -343,4 +342,2 @@ } | ||
localErrors = await validateWithSchema(validationSchema, values); | ||
console.log(values); | ||
console.log(localErrors); | ||
if (localErrors === undefined) { | ||
@@ -347,0 +344,0 @@ callback(values, e); |
@@ -0,1 +1,2 @@ | ||
export declare function parseErrorSchema(error: any): any; | ||
export default function validateWithSchema(ValidationSchema: any, data: any): Promise<any>; |
{ | ||
"name": "react-hook-form", | ||
"version": "0.4.0-beta.5", | ||
"version": "0.4.0-beta.6", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.es.js", |
40343
897