Skip to content

Commit

Permalink
Move removal of unused props into its own method to make it easy to s…
Browse files Browse the repository at this point in the history
…ubclass (#56)
  • Loading branch information
ankurp authored and javivelasco committed May 12, 2017
1 parent 4befee0 commit cd752ab
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/themr.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
: {}
}

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

return props
}

getTheme(props) {
return props.composeTheme === COMPOSE_SOFTLY
? {
Expand Down Expand Up @@ -136,9 +144,8 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
}

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

return React.createElement(ThemedComponent, {
...props,
Expand Down

0 comments on commit cd752ab

Please sign in to comment.