Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set StyledComponent context directly on every class #807

Merged
merged 2 commits into from May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. If a contri
- Add `innerRef` support to `withTheme` HOC. (see [#710](https://github.com/styled-components/styled-components/pull/710))
- Switch to babel-preset-env. (see [#717](https://github.com/styled-components/styled-components/pull/717))
- Update StyledNativeComponent to match StyledComponent implementation.
- Fix Theme context for StyledComponent for IE <10. (see [#807](https://github.com/styled-components/styled-components/pull/807))

## [Unreleased]

Expand Down
6 changes: 6 additions & 0 deletions src/models/StyledComponent.js
@@ -1,6 +1,7 @@
// @flow

import { createElement } from 'react'
import PropTypes from 'prop-types'

import type { Theme } from './ThemeProvider'
import createWarnTooManyClasses from '../utils/createWarnTooManyClasses'
Expand Down Expand Up @@ -191,6 +192,11 @@ export default (ComponentStyle: Function, constructWithOptions: Function) => {
)

class StyledComponent extends ParentComponent {
static contextTypes = {
[CHANNEL]: PropTypes.func,
[CONTEXT_KEY]: PropTypes.instanceOf(StyleSheet),
}

static displayName = displayName
static styledComponentId = componentId
static attrs = attrs
Expand Down