Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit a214b18

Browse files
committed
fix(emotion): fix css & styled function with babel-plugin-emotion
1 parent 5b46cfc commit a214b18

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/shared/core/styled-engine/emotion.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ const css = (...args) => {
6060

6161
function patchStyledComponent(StyledComponent) {
6262
const { withComponent } = StyledComponent
63-
StyledComponent.withComponent = component => {
63+
StyledComponent.withComponent = (component, options) => {
6464
// eslint-disable-next-line no-underscore-dangle
6565
const BaseComponent = StyledComponent.__emotion_base
6666
return Object.assign(
6767
patchStyledComponent(
68-
withComponent(props => <BaseComponent as={component} {...props} />),
68+
withComponent(
69+
props => <BaseComponent as={component} {...props} />,
70+
options,
71+
),
6972
),
7073
StyledComponent,
7174
)
@@ -83,7 +86,8 @@ function wrapCreateStyledComponent(createStyledComponent) {
8386
}
8487

8588
function wrapStyled(styled) {
86-
return component => wrapCreateStyledComponent(styled(component))
89+
return (component, options) =>
90+
wrapCreateStyledComponent(styled(component, options))
8791
}
8892

8993
const styled = wrapStyled(emotionStyled)

0 commit comments

Comments
 (0)