Skip to content

Commit

Permalink
Don't pass innerRef prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrik Nicol authored and rtsao committed Jan 26, 2017
1 parent 150c79d commit aa7a931
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/styletron-react/src/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,23 @@ function createStyledElementComponent(tagName, stylesArray) {

class StyledElement extends React.Component {
render() {
const restProps = assign({}, this.props);
delete restProps.innerRef;

const resolvedStyle = {};
StyledElement[STYLES_KEY].forEach(style => {
if (typeof style === 'function') {
assign(resolvedStyle, style(this.props, this.context));
assign(resolvedStyle, style(restProps, this.context));
} else if (typeof style === 'object') {
assign(resolvedStyle, style);
}
});

const styletronClassName = utils.injectStylePrefixed(this.context.styletron, resolvedStyle);

const elementProps = typeof StyledElement[TAG_KEY] === 'string' ? omitInvalidProps(this.props) : assign({}, this.props);
elementProps.className = this.props.className
? `${this.props.className} ${styletronClassName}`
const elementProps = typeof StyledElement[TAG_KEY] === 'string' ? omitInvalidProps(restProps) : restProps;
elementProps.className = restProps.className
? `${restProps.className} ${styletronClassName}`
: styletronClassName;

if (this.props.innerRef) {
Expand Down

0 comments on commit aa7a931

Please sign in to comment.