From 72168e20699e734229ba32125b97f1316d6ab1ec Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 13 Feb 2026 10:23:47 +0100 Subject: [PATCH 1/3] Fix: Remove HTMLElement constraint for React Native compatibility Fixes #1051 Changes: - Remove 'T extends HTMLElement' constraint from FieldInputProps, FieldRenderProps, and FieldProps - Change to 'T = any' to support both React DOM and React Native - Re-export FieldMetaState type for backwards compatibility (was removed in v7.0.0) This allows React Native users to use react-final-form without TypeScript errors while maintaining full backwards compatibility with React DOM users. --- src/types.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/types.ts b/src/types.ts index e09c96f..fbbb47d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -17,7 +17,7 @@ export interface ReactContext> { export interface FieldInputProps< FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, > { name: string; onBlur: (event?: React.FocusEvent) => void; @@ -31,7 +31,7 @@ export interface FieldInputProps< export interface FieldRenderProps< FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, _FormValues = any, > { input: FieldInputProps; @@ -58,6 +58,9 @@ export interface FieldRenderProps< }; } +// Re-export FieldMetaState for backwards compatibility (removed in v7.0.0) +export type FieldMetaState = FieldRenderProps['meta']; + export interface SubmitEvent { preventDefault?: () => void; stopPropagation?: () => void; @@ -120,7 +123,7 @@ export interface UseFieldConfig extends UseFieldAutoConfig { export interface FieldProps< FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, _FormValues = Record, > extends UseFieldConfig, Omit>, "children"> { From d6111dcdababf407ef13c51bdedcee60e8660efa Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 13 Feb 2026 18:27:08 +0100 Subject: [PATCH 2/3] fix: Update TypeScript declarations to match React Native type changes - Change generic constraint from 'T extends HTMLElement = HTMLElement' to 'T = any' - Add FieldMetaState type export for backwards compatibility - Sync all type declarations with src/types.ts changes --- typescript/index.d.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/typescript/index.d.ts b/typescript/index.d.ts index fb81265..7eac614 100644 --- a/typescript/index.d.ts +++ b/typescript/index.d.ts @@ -17,7 +17,7 @@ export interface ReactContext> { export interface FieldInputProps< FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, > { name: string; onBlur: (event?: React.FocusEvent) => void; @@ -31,7 +31,7 @@ export interface FieldInputProps< export interface FieldRenderProps< FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, _FormValues = any, > { input: FieldInputProps; @@ -58,6 +58,9 @@ export interface FieldRenderProps< }; } +// Re-export FieldMetaState for backwards compatibility (removed in v7.0.0) +export type FieldMetaState = FieldRenderProps['meta']; + export interface SubmitEvent { preventDefault?: () => void; stopPropagation?: () => void; @@ -119,7 +122,7 @@ export interface UseFieldConfig extends UseFieldAutoConfig { export interface FieldProps< FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, _FormValues = Record, > extends UseFieldConfig, Omit>, "children"> { @@ -144,7 +147,7 @@ export interface FormSpyPropsWithForm> export const Field: < FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, FormValues = Record, >( props: FieldProps, @@ -160,7 +163,7 @@ export const FormSpy: >( export function useField< FieldValue = any, - T extends HTMLElement = HTMLElement, + T = any, FormValues = Record, >( name: string, From 2437ab0b2c0cfdcf6d16b468ebab0790cd0af34d Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 13 Feb 2026 18:34:49 +0100 Subject: [PATCH 3/3] docs: Clarify FieldMetaState comment per CodeRabbit feedback Changed comment from '(removed in v7.0.0)' which reads like a future removal, to clarify it was removed from sources but re-exported here for backwards compatibility. --- src/types.ts | 3 ++- typescript/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index fbbb47d..5987e29 100644 --- a/src/types.ts +++ b/src/types.ts @@ -58,7 +58,8 @@ export interface FieldRenderProps< }; } -// Re-export FieldMetaState for backwards compatibility (removed in v7.0.0) +// Re-export of FieldMetaState for backwards compatibility +// (removed from original sources in v7.0.0 but re-exported here) export type FieldMetaState = FieldRenderProps['meta']; export interface SubmitEvent { diff --git a/typescript/index.d.ts b/typescript/index.d.ts index 7eac614..445c93a 100644 --- a/typescript/index.d.ts +++ b/typescript/index.d.ts @@ -58,7 +58,8 @@ export interface FieldRenderProps< }; } -// Re-export FieldMetaState for backwards compatibility (removed in v7.0.0) +// Re-export of FieldMetaState for backwards compatibility +// (removed from original sources in v7.0.0 but re-exported here) export type FieldMetaState = FieldRenderProps['meta']; export interface SubmitEvent {