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

Commit

Permalink
fix(emotion): fix css & styled function with babel-plugin-emotion
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Oct 17, 2018
1 parent 5b46cfc commit a214b18
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/shared/core/styled-engine/emotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@ const css = (...args) => {

function patchStyledComponent(StyledComponent) {
const { withComponent } = StyledComponent
StyledComponent.withComponent = component => {
StyledComponent.withComponent = (component, options) => {
// eslint-disable-next-line no-underscore-dangle
const BaseComponent = StyledComponent.__emotion_base
return Object.assign(
patchStyledComponent(
withComponent(props => <BaseComponent as={component} {...props} />),
withComponent(
props => <BaseComponent as={component} {...props} />,
options,
),
),
StyledComponent,
)
Expand All @@ -83,7 +86,8 @@ function wrapCreateStyledComponent(createStyledComponent) {
}

function wrapStyled(styled) {
return component => wrapCreateStyledComponent(styled(component))
return (component, options) =>
wrapCreateStyledComponent(styled(component, options))
}

const styled = wrapStyled(emotionStyled)
Expand Down

0 comments on commit a214b18

Please sign in to comment.