Skip to content

Commit 78398f6

Browse files
ankurpdavid-slayte
authored andcommitted
Move removal of unused props into its own method to make it easy to subclass (javivelasco#56)
1 parent bad51e4 commit 78398f6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/components/themr.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
105105
: {}
106106
}
107107

108+
getPropsForComponent() {
109+
//exclude themr-only props
110+
//noinspection JSUnusedLocalSymbols
111+
const { composeTheme, innerRef, themeNamespace, ...props } = this.props //eslint-disable-line no-unused-vars
112+
113+
return props
114+
}
115+
108116
getTheme(props) {
109117
return props.composeTheme === COMPOSE_SOFTLY
110118
? {
@@ -136,9 +144,8 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
136144
}
137145

138146
render() {
139-
//exclude themr-only props
140-
//noinspection JSUnusedLocalSymbols
141-
const { composeTheme, innerRef, themeNamespace, ...props } = this.props //eslint-disable-line no-unused-vars
147+
const { innerRef } = this.props
148+
const props = this.getPropsForComponent()
142149

143150
return React.createElement(ThemedComponent, {
144151
...props,

0 commit comments

Comments
 (0)