Skip to content

Commit

Permalink
Merge pull request react-bootstrap#1448 from taion/ResponsiveEmbed
Browse files Browse the repository at this point in the history
[fixed] Don't clone children in ResponsiveEmbed
  • Loading branch information
AlexKVal committed Oct 28, 2015
2 parents 60b8af2 + df2f1a3 commit 3bb42f2
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 3bb42f2

Please sign in to comment.