data-driven-forms / react-forms

React library for rendering forms.
https://data-driven-forms.org/
Apache License 2.0
302 stars 87 forks source link

Conditional rendering is not working for accordion tabs #1458

Closed adityapatil9191 closed 5 months ago

adityapatil9191 commented 5 months ago

Scope: <DESCRIBE SCOPE OF THIS ISSUE, i.e.: PF4 mapper, Form renderer> https://codesandbox.io/p/sandbox/react-data-driven-autocomplete-3yy7r6?file=%2Fsrc%2Findex.js Description

In the above code sandbox if we add condition to accordion tabs, for example if a form accordion tab should be visible only if form value present in another Accordion tab is true or has some value, then the conditions don't work and the accordion tab is always visible.

Schema

<If it's possible, please provide a schema which reproduces the issue>

adityapatil9191 commented 5 months ago

Please help / respond

rvsia commented 5 months ago

Hey, if I understand your issue correctly, then I think the issue is here:

Snímek obrazovky 2024-05-10 v 7 29 11

When you render tab components, there is actually no data driven from component (so no condition is calculated), but you render directly children of the component. You can wrap this section to a new component in the mapper and then just do formOptions.renderForm(fields)