Passing the as
prop to a multiple style layered component only applies the first styles
#3115
Open
1 of 3 tasks
Description
Hello,
Thank you for your contribution to this wonderful library. You can see the bug in the reproduction link. Bellow is an explanation with the problem and a fix.
The issue is in the
src/styled-system/jsx/factory.js
file with this line:If
as
is a string, for example,h1
it will call:And will create an
h1
with the classes and styles from the component. The problem is that__base__
is a react component. In our case compB
which renders compA
. They will be ignored and theas
value will be used.To fix it, I've changed the code to be the following in
factory.js
:This way the styles are kept from the other components and the
as
thingy also works.Link to Reproduction
https://stackblitz.com/edit/vitejs-vite-enjwupkj?file=src%2FApp.tsx
Steps to reproduce
some styles
and B = styled(A)other styles
JS Framework
No response
Panda CSS Version
0.48.0
Browser
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: