You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a normal slot like below, if you use asChild prop, you are not allowed to have inner content (eg an Icon):
exportfunctionComponent({ asChild, children }){constAs=asChild ? Slot : "button";return<As><SomeIcon/>{children}</As>}
This will cause a children array which is not allowed (since the Slot relies in the cloneElement function). Then radix introduced Slottable, which is basically a simple fragment wrapper which is used to do something like this:
exportfunctionComponent({ asChild, children }){constAs=asChild ? Slot : "button";return<As><SomeIcon/><Slottable>{children}</Slottable></As>}
Now you can use the component normally, because if you use asChild then the Slottable children will be cloned and not the Slot children itself
In radix there's a Slottable component to be used with Slot which allow sibling components inside the slot (https://www.radix-ui.com/primitives/docs/utilities/slot#basic-example). It would be awesome to use in RN as well
The text was updated successfully, but these errors were encountered: