react-hook-form
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -333,3 +333,3 @@ import { useRef, useState, useEffect } from 'react'; | ||
} | ||
const inputData = Object.assign({}, data, { required: undefined, validate: undefined, ref: elementRef }); | ||
const inputData = Object.assign({}, data, { ref: elementRef }); | ||
let radioOptionIndex; | ||
@@ -373,6 +373,14 @@ const { ref, required, validate, ref: { name, type, value }, } = inputData; | ||
function register(data) { | ||
if (!data) { | ||
console.error('Looks like ref is missing.'); | ||
return; | ||
} | ||
if (data instanceof HTMLElement) { | ||
registerIntoAllFields(data); | ||
} | ||
return ref => registerIntoAllFields(ref, data); | ||
return ref => { | ||
if (ref) { | ||
registerIntoAllFields(ref, data); | ||
} | ||
}; | ||
} | ||
@@ -443,2 +451,3 @@ function watch(filedNames, defaultValue) { | ||
}); | ||
// @ts-ignore | ||
} | ||
@@ -445,0 +454,0 @@ else if (!fields.current[name].eventAttached || !fields.current[name].eventAttached.includes('input')) { |
@@ -335,3 +335,3 @@ 'use strict'; | ||
} | ||
const inputData = Object.assign({}, data, { required: undefined, validate: undefined, ref: elementRef }); | ||
const inputData = Object.assign({}, data, { ref: elementRef }); | ||
let radioOptionIndex; | ||
@@ -375,6 +375,14 @@ const { ref, required, validate, ref: { name, type, value }, } = inputData; | ||
function register(data) { | ||
if (!data) { | ||
console.error('Looks like ref is missing.'); | ||
return; | ||
} | ||
if (data instanceof HTMLElement) { | ||
registerIntoAllFields(data); | ||
} | ||
return ref => registerIntoAllFields(ref, data); | ||
return ref => { | ||
if (ref) { | ||
registerIntoAllFields(ref, data); | ||
} | ||
}; | ||
} | ||
@@ -445,2 +453,3 @@ function watch(filedNames, defaultValue) { | ||
}); | ||
// @ts-ignore | ||
} | ||
@@ -447,0 +456,0 @@ else if (!fields.current[name].eventAttached || !fields.current[name].eventAttached.includes('input')) { |
{ | ||
"name": "react-hook-form", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.es.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50082
1151