Fix Creating textarea custom field

[MAILPOET-2719]
This commit is contained in:
Pavel Dohnal
2020-03-11 14:59:11 +01:00
parent 27bf71bad9
commit a98e98487b
2 changed files with 5 additions and 1 deletions

View File

@@ -87,6 +87,7 @@ const AddCustomFieldForm = ({ dateSettings, onSubmit }) => {
<TextFieldSettings
mandatory={fieldSettings.mandatory ? fieldSettings.mandatory : false}
validate={fieldSettings.validate ? fieldSettings.validate : ''}
fieldType={fieldType}
onChange={setFieldSettings}
/>
);

View File

@@ -17,6 +17,7 @@ const CustomFieldSettings = ({
isDeleting,
onCustomFieldDelete,
onChange,
fieldType,
}) => {
const [localMandatory, setLocalMandatory] = useState(mandatory);
const [localValidate, setLocalValidate] = useState(validate);
@@ -33,7 +34,7 @@ const CustomFieldSettings = ({
if (onChange) {
onChange(localData, hasUnsavedChanges);
}
}, [localData, onChange, hasUnsavedChanges]);
}, [localData, onChange, hasUnsavedChanges, fieldType]);
return (
<>
@@ -94,10 +95,12 @@ CustomFieldSettings.propTypes = {
isDeleting: PropTypes.bool,
onCustomFieldDelete: PropTypes.func,
onChange: PropTypes.func,
fieldType: PropTypes.string,
};
CustomFieldSettings.defaultProps = {
mandatory: false,
fieldType: '',
isSaving: false,
validate: '',
isDeleting: false,