diff --git a/.changeset/dirty-elephants-dream.md b/.changeset/dirty-elephants-dream.md new file mode 100644 index 00000000000..69886caee6d --- /dev/null +++ b/.changeset/dirty-elephants-dream.md @@ -0,0 +1,5 @@ +--- +"@talend/react-forms": patch +--- + +fix: check onFinish and onChange before invoking for the Text component diff --git a/packages/forms/src/UIForm/fields/Text/Text.component.js b/packages/forms/src/UIForm/fields/Text/Text.component.js index 9e2b36bc1e8..333d442fcb2 100644 --- a/packages/forms/src/UIForm/fields/Text/Text.component.js +++ b/packages/forms/src/UIForm/fields/Text/Text.component.js @@ -36,8 +36,16 @@ export default function Text(props) { autoComplete, autoFocus, disabled: disabled || valueIsUpdating, - onBlur: event => onFinish(event, { schema }), - onChange: event => onChange(event, { schema, value: convertValue(type, event.target.value) }), + onBlur: event => { + if (onFinish) { + onFinish(event, { schema }); + } + }, + onChange: event => { + if (onChange) { + onChange(event, { schema, value: convertValue(type, event.target.value) }); + } + }, placeholder, readOnly, type,