formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
119 stars 4 forks source link

Allow passing ref to View component. #272

Closed mareksed closed 4 months ago

mareksed commented 4 months ago

Is your feature request related to a problem? Please describe. I cannot use refs with View components

Describe the solution you'd like Use React.forwardProps with View component

Describe alternatives you've considered At the moment we can always wrap the component with a div and pass ref to it, but it would be nice if this was supported out of the box.

blvdmitry commented 4 months ago

Even though we currently don't support refs on the top level, we already support passing refs with the attributes prop. It's still a good idea to start enabling that on the top level with React 19 supporting refs without forwarding

mareksed commented 4 months ago

Ahh ofcourse, should have dug deeper. Intuitively I ruled attributes out because I thought they are only for standard html props, but I see how it is designed now, makes sense. Thx this should work for all the use cases that top level ref does.

and +1 for react19 to make them top level.