Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
filter themr props
  • Loading branch information
raveclassic committed Oct 3, 2016
commit 25cce9fd22821aeb20b5d427d41de12ebadd2edf
10 changes: 8 additions & 2 deletions src/components/themr.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
localTheme
}

/**
* @property {{wrappedInstance: *}} refs
*/
class Themed extends Component {
static displayName = `Themed${ThemedComponent.name}`;

Expand Down Expand Up @@ -134,16 +137,19 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>

render() {
let renderedElement
//exclude themr-only props
//noinspection JSUnusedLocalSymbols
const { composeTheme, themeNamespace, ...props } = this.props //eslint-disable-line no-unused-vars

if (optionWithRef) {
renderedElement = React.createElement(ThemedComponent, {
...this.props,
...props,
ref: 'wrappedInstance',
theme: this.theme_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why theme prop itself is not a problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost everywhere it is extracted: const {theme, ...props} = this.props; return <input {...props}/>;

})
} else {
renderedElement = React.createElement(ThemedComponent, {
...this.props,
...props,
theme: this.theme_
})
}
Expand Down