Skip to content

Move removal of unused props into its own method to make it easy to subclass #56

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

Merged
merged 1 commit into from
May 12, 2017
Merged
Changes from all commits
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
13 changes: 10 additions & 3 deletions src/components/themr.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,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 @@ -135,9 +143,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