Struggling with incorporating the Collapse + TransitionGroup Component in MUI while trying to make the containers expand using flexbox.
<Box sx={{display: 'flex', height: '100vh', width: '100vw'}}>
<Box sx={{flex: 1}}>Content-A</Box>
<Box sx={{flex: 1}}>Content-B</Box>
</Box>
Here is a basic setup I'm aiming for. Both Boxes side by side, dividing the entire page into left and right sections. However, integrating the Collapse Component causes issues:
<TransitionGroup sx={{display: 'flex', height: '100vh', width: '100vw}}>
<Collapse orientation='horizontal'>
<Box sx={{flex: 1}}>Content-A</Box>
</Collapse>
<Collapse orientation='horizontal'>
<Box sx={{flex: 1}}>Content-B</Box>
</Collapse>
</TransitionGroup>
The Collapse component seems to disrupt the Flexbox parent-child connection. Upon inspecting the DOM, I see that the Collapse Component adds 3 wrappers around the child component (root, outer, inner wrap). How can I pass down the flexbox properties to the original child?
I attempted to override the styles of these wrapping components in the theme and assign them display: flex, flex: 1
to propagate it all the way down to the child, but this results in choppy transitions.
EDIT: To clarify, the reason for needing the transition group is because I want a specific transition effect. Essentially, I have the page split into left (A) and right (B). When triggered, (A) should transition off the screen to the left (horizontally), (B) moves to where (A) was, and a new element (C) slides in from the right to take B's place. Think of it as a Sliding Queue. This process repeats (B exits -> C moves to B's position -> D transitions in). The problem arises when using Collapse horizontally as it doesn't adjust to fill the remaining space.