Skip to content

Filter themr props #27

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 4 commits into from
Oct 8, 2016
Merged

Conversation

raveclassic
Copy link
Contributor

After merging #26 props are now passed unfiltered including themr-only props like composeTheme and themeNamespace.
If you have a component-wrapper that passes all props to native component (for example native <input/>) via object spread (<input {...this.props}/>), React complains about unknown prop: Warning: Unknown prop 'composeTheme' on <input> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
This PR aims on fixing this problem.


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}/>;

@javivelasco
Copy link
Owner

Thanks I missed it!

@javivelasco javivelasco merged commit 8ba8c69 into javivelasco:master Oct 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants