Open 3dos opened 5 years ago
You could return a function as the error from validate and get the actual string value when rendering the error: https://codesandbox.io/s/final-form-i18next-gcedw
@3dos I think you should keep only error code in the final form state, and render error message in view https://codesandbox.io/s/final-form-i18next-brb1f
@3dos , you can try use
<Field key={i18n.language} .../>
or do as @istee suggested, and wrap RFF Field component with your component like that
import { Field as ReactField } from 'react-final-form';
const Field = ({ t, ...other }) => <ReactField t={t} {...other} />;
export default withTranslations()(Field);
so you don't need to pass every time that dependency
Bug report
Current behavior
Changing language doesn't triggers a language change in already present validation errors. CodeSandbox example: https://codesandbox.io/s/final-form-i18next-fgl1o
To actually reproduce the bug, click on the field without entering a value to make the validation error appear, then switch language with the top button.
Expected behavior
Rerender or provide a way to force rerendering the field when language changes.