diff --git a/src/styled.js b/src/styled.js
index 57b68f8..1996839 100644
--- a/src/styled.js
+++ b/src/styled.js
@@ -38,11 +38,11 @@ const styled = ({element, ownStyle, mountSheet, jss}: StyledArgs) => {
const {
style,
tagName,
- reactComponent = tagName
+ reactComponent,
}: {
style?: ComponentStyleType,
tagName: string,
- reactComponent?: string | typeof element
+ reactComponent?: typeof element
} = getParamsByElement(element)
const elementStyle = {...style, ...ownStyle}
@@ -114,7 +114,7 @@ const styled = ({element, ownStyle, mountSheet, jss}: StyledArgs) => {
render() {
const {children, className, ...attrs} = this.props
- const props = filterProps(tagName, attrs)
+ const props = reactComponent ? attrs : filterProps(tagName, attrs)
const tagClass = composeClasses([
this.staticClassName,
staticTagName && this.sheet.classes[staticTagName],
@@ -122,7 +122,7 @@ const styled = ({element, ownStyle, mountSheet, jss}: StyledArgs) => {
className
])
- return createElement(reactComponent, {...props, className: tagClass}, children)
+ return createElement(reactComponent || tagName, {...props, className: tagClass}, children)
}
}
diff --git a/src/tests/__snapshots__/functional.spec.jsx.snap b/src/tests/__snapshots__/functional.spec.jsx.snap
index ca92fc7..b659553 100644
--- a/src/tests/__snapshots__/functional.spec.jsx.snap
+++ b/src/tests/__snapshots__/functional.spec.jsx.snap
@@ -1,5 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`functional tests Compose React Components should pass props 1`] = `
+
+
+
+ {"testProp":1,"testProp2":"2","className":"StyledElement-1-id testClassName"}
+
+
+
+`;
+
+exports[`functional tests Compose React Components should pass props 2`] = `
+".StyledElement-1-id {
+ padding: 10px;
+}"
+`;
+
exports[`functional tests Compose React Components should use .displayName 1`] = `
{
it('should use .name', () => {
const StyledTest = styled(props => test
)({
- padding: 30,
+ padding: 10,
})
assertComponent(StyledTest)
assertSheet(styled.sheet)
})
+
+ it('should pass props', () => {
+ const StyledTest = styled(props => JSON.stringify(props))({
+ padding: 10,
+ })
+ assertComponent(() => )
+ assertSheet(styled.sheet)
+ })
})
})