Skip to content

Commit

Permalink
[fixed] Don't clone children in ResponsiveEmbed
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Oct 27, 2015
1 parent 60b8af2 commit df2f1a3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/ResponsiveEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import warning from 'warning';

class ResponsiveEmbed extends React.Component {
render() {
const { bsClass, className, a16by9, a4by3, ...props } = this.props;
const { bsClass, className, a16by9, a4by3, children, ...props } = this.props;
warning(!(!a16by9 && !a4by3), '`a16by9` or `a4by3` attribute must be set.');
warning(!(a16by9 && a4by3), 'Either `a16by9` or `a4by3` attribute can be set. Not both.');

Expand All @@ -16,13 +16,10 @@ class ResponsiveEmbed extends React.Component {

return (
<div className={classNames(bsClass, aspectRatio)}>
{cloneElement(
this.props.children,
{
...props,
className: classNames(className, 'embed-responsive-item')
}
)}
{cloneElement(children, {
...props,
className: classNames(className, 'embed-responsive-item')
})}
</div>
);
}
Expand Down

0 comments on commit df2f1a3

Please sign in to comment.