When an unfocused tab has a validation error, the tab header should appear red. Instead of that, when an unfocused tab has a validation error, the tab header does not give any indication of the error.
This issue happens when I'm using subcomponents. If all the components are defined at the Create/Edit level, then the tab turns red as expected. But if there are nested components, then the tab does not.
Is there a way I can "pass" the validation to my custom component or mark my custom fields as invalid so the tabs are properly marked in red when they have an invalid field?
In my code, for example, I use a custom input as subcomponent. While the inputs turn on red when invalid, the tabs does not.
- This code works.
export const ProductCreate = (props) => (
<Create {...props}>
<TabbedForm>
<FormTab label="settings">
<Field component={TextInput} name="name" label="Name" validate={required} {...props} />
<SettingsTab />
</FormTab>
<FormTab label="sizes">
<SizesTab />
</FormTab>
</TabbedForm>
</Create>
);
- By moving the field into a subcomponent, the validation indicator does not work.
export const ProductCreate = (props) => (
<Create {...props}>
<TabbedForm>
<FormTab label="settings">
<SettingsTab />
</FormTab>
<FormTab label="sizes">
<SizesTab />
</FormTab>
</TabbedForm>
</Create>
);
export const SettingsTab = (props) => (
<div>
<Field component={TextInput} name="name" label="Name" validate={required} {...props} />
</div>
);
I'm stuck with this issue and I can't change my current react-admin version (react-admin@^2.9.3) without breaking many dependencies on my project.