Skip to content

Commit

Permalink
fix #9713 regression on validate function with react native
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebill1049 committed Jan 4, 2023
1 parent 33ad1d5 commit bcfb169
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/logic/createFormControl.ts
Expand Up @@ -530,7 +530,7 @@ export function createFormControl<
set(_formValues, name, getFieldValueAs(value, fieldReference));

fieldValue =
isWeb && isHTMLElement(fieldReference.ref) && isNullOrUndefined(value)
isHTMLElement(fieldReference.ref) && isNullOrUndefined(value)
? ''
: value;

Expand Down
6 changes: 6 additions & 0 deletions src/utils/isHTMLElement.ts
@@ -1,4 +1,10 @@
import isWeb from './isWeb';

export default (value: unknown): value is HTMLElement => {
if (!isWeb) {
return false;
}

const owner = value ? ((value as HTMLElement).ownerDocument as Document) : 0;
return (
value instanceof
Expand Down

0 comments on commit bcfb169

Please sign in to comment.