adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.83k stars 1.11k forks source link

Table(react-aria-components): Cannot use Render Props with `Cell` #4408

Closed jaknas closed 1 year ago

jaknas commented 1 year ago

🐛 Bug Report

When using render props with Cell, any content returned from render prop function won't be rendered.

🤔 Expected Behavior

It should be possible to use render props with Cell component and have the returned component be rendered.

😯 Current Behavior

as above

💻 Code Sample

https://codesandbox.io/s/dazzling-shtern-urznq3?file=/src/App.js

In the codesandbox above, I'd expect Games text to be rendered. For comparison, I used render props with column and it works as expected there.

snowystinger commented 1 year ago

Thanks for reporting! I think Cell is missing a call to useCollectionChildren https://github.com/adobe/react-spectrum/blob/main/packages/react-aria-components/src/Table.tsx#L535

LFDanLu commented 1 year ago

I actually think this is in a similar vein to https://github.com/adobe/react-spectrum/issues/4369, https://github.com/adobe/react-spectrum/blob/b92f6029e71aa29a9f7b35e403586856a90004ad/packages/react-aria-components/src/Table.tsx#L845 should have renderProps.children instead.