From 8c81293108ffc334eba757fc9172f8b312b7c6e7 Mon Sep 17 00:00:00 2001 From: george-usynin-binary Date: Wed, 24 Aug 2022 18:49:52 +0300 Subject: [PATCH] fix(account transfer): fix validation error visibility --- .../account-transfer-form.jsx | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.jsx b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.jsx index 5b87fb89a5e3..f138eda6b583 100644 --- a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.jsx +++ b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.jsx @@ -425,16 +425,7 @@ const AccountTransferForm = ({ validateOnBlur={false} enableReinitialize > - {({ - errors, - handleChange, - isSubmitting, - touched, - setFieldValue, - setFieldTouched, - setFieldError, - values, - }) => ( + {({ errors, handleChange, isSubmitting, setFieldValue, setFieldError, values }) => ( {isSubmitting || accounts_list.length === 0 ? (
@@ -460,8 +451,7 @@ const AccountTransferForm = ({ onChangeTransferFrom(e); handleChange(e); setFieldValue('amount', ''); - setFieldError('amount', ''); - setFieldTouched('amount', false); + setTimeout(() => setFieldError('amount', '')); }} error={selected_from.error} /> @@ -482,8 +472,7 @@ const AccountTransferForm = ({ onChange={e => { onChangeTransferTo(e); setFieldValue('amount', ''); - setFieldError('amount', ''); - setFieldTouched('amount', false); + setTimeout(() => setFieldError('amount', '')); }} hint={transfer_to_hint} error={selected_to.error} @@ -498,13 +487,12 @@ const AccountTransferForm = ({ setErrorMessage(''); handleChange(e); setAccountTransferAmount(e.target.value); - setFieldTouched('amount', true, false); }} className='cashier__input dc-input--no-placeholder account-transfer-form__input' classNameHint='account-transfer-form__hint' type='text' label={localize('Amount')} - error={touched.amount && errors.amount ? errors.amount : ''} + error={errors.amount ? errors.amount : ''} required trailing_icon={ selected_from.currency ? (