File tree Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,11 @@ import React, { PropTypes } from 'react';
33export default class Frame extends React . Component {
44 static propTypes = {
55 children : PropTypes . any ,
6- component : PropTypes . string ,
76 duration : PropTypes . number ,
87 onRender : PropTypes . func
98 } ;
109
1110 static defaultProps = {
12- component : null ,
1311 duration : 0 ,
1412 onRender : ( ) => { }
1513 } ;
@@ -23,7 +21,6 @@ export default class Frame extends React.Component {
2321 }
2422
2523 render ( ) {
26- const { component } = this . props ;
27- return React . createElement ( component , null , this . props . children ) ;
24+ return null ;
2825 }
2926}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const noop = () => {};
55export default class Keyframes extends React . Component {
66 static propTypes = {
77 children : PropTypes . arrayOf ( PropTypes . element ) . isRequired ,
8- component : PropTypes . string ,
8+ component : PropTypes . any ,
99 delay : PropTypes . number ,
1010 onStart : PropTypes . func ,
1111 onEnd : PropTypes . func
@@ -58,8 +58,11 @@ export default class Keyframes extends React.Component {
5858 const frame = this . getFrame ( ) ;
5959 if ( ! frame ) return null ;
6060
61- const component = frame . props . component || this . props . component ;
62- return React . cloneElement ( frame , { component } ) ;
61+ return React . createElement (
62+ this . props . component ,
63+ this . props ,
64+ frame . props . children
65+ ) ;
6366 }
6467
6568 requestNextFrame ( ) {
Original file line number Diff line number Diff line change @@ -58,3 +58,17 @@ test('Keyframes events', (t) => {
5858 clock . tick ( 100 ) ;
5959 t . ok ( onEnd . called ) ;
6060} ) ;
61+
62+ test ( 'set component' , ( t ) => {
63+ const container = document . createElement ( 'div' ) ;
64+ const component = render (
65+ < Keyframes component = "pre" className = "woot" >
66+ < Frame > foo</ Frame >
67+ < Frame > bar</ Frame >
68+ </ Keyframes > ,
69+ container
70+ ) ;
71+ const node = findDOMNode ( component ) ;
72+ t . same ( node . tagName , 'PRE' ) ;
73+ t . same ( node . className , 'woot' ) ;
74+ } ) ;
You can’t perform that action at this time.
0 commit comments