File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import React, { PropTypes } from 'react';
33export default class Frame extends React . Component {
44 static propTypes = {
55 children : PropTypes . any ,
6+ component : PropTypes . any ,
67 duration : PropTypes . number ,
78 onRender : PropTypes . func
89 } ;
@@ -21,6 +22,7 @@ export default class Frame extends React.Component {
2122 }
2223
2324 render ( ) {
24- return null ;
25+ const { component } = this . props ;
26+ return React . createElement ( component , this . props , this . props . children ) ;
2527 }
2628}
Original file line number Diff line number Diff line change @@ -58,11 +58,8 @@ export default class Keyframes extends React.Component {
5858 const frame = this . getFrame ( ) ;
5959 if ( ! frame ) return null ;
6060
61- return React . createElement (
62- this . props . component ,
63- this . props ,
64- frame . props . children
65- ) ;
61+ const props = { ...this . props , ...frame . props } ;
62+ return React . cloneElement ( frame , props ) ;
6663 }
6764
6865 requestNextFrame ( ) {
Original file line number Diff line number Diff line change 1212 "babel-plugin-syntax-async-functions" : " 6.5.0" ,
1313 "babel-plugin-transform-async-to-generator" : " 6.7.0" ,
1414 "babel-plugin-transform-class-properties" : " 6.6.0" ,
15+ "babel-plugin-transform-object-rest-spread" : " 6.6.5" ,
1516 "babel-plugin-transform-runtime" : " 6.6.0" ,
1617 "babel-preset-es2015" : " 6.6.0" ,
1718 "babel-preset-react" : " 6.5.0" ,
4243 " react"
4344 ],
4445 "plugins" : [
45- " transform-class-properties"
46+ " transform-class-properties" ,
47+ " transform-object-rest-spread"
4648 ]
4749 },
4850 "ava" : {
6365 " syntax-async-functions" ,
6466 " transform-async-to-generator" ,
6567 " transform-class-properties" ,
68+ " transform-object-rest-spread" ,
6669 " transform-runtime"
6770 ]
6871 }
Original file line number Diff line number Diff line change @@ -59,6 +59,22 @@ test('Keyframes events', (t) => {
5959 t . ok ( onEnd . called ) ;
6060} ) ;
6161
62+ test ( 'Frame event' , ( t ) => {
63+ const container = document . createElement ( 'div' ) ;
64+ const onRender = ( ) => onRender . called = true ;
65+ render (
66+ < Keyframes >
67+ < Frame duration = { 100 } > foo</ Frame >
68+ < Frame duration = { 100 } onRender = { onRender } > bar</ Frame >
69+ </ Keyframes > ,
70+ container
71+ ) ;
72+
73+ t . notOk ( onRender . called ) ;
74+ clock . tick ( 100 ) ;
75+ t . ok ( onRender . called ) ;
76+ } ) ;
77+
6278test ( 'set component' , ( t ) => {
6379 const container = document . createElement ( 'div' ) ;
6480 const component = render (
You can’t perform that action at this time.
0 commit comments