File tree Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ React.render(<TweenOneGroup>
92
92
93
93
### props
94
94
95
+ > 2.5.x add currentRef, ` <TweenOne component={Row} ref={(c) => { c.currentRef === <Row /> }} /> `
96
+
95
97
| name | type | default | description |
96
98
| ------------| ----------------| ---------| ----------------|
97
99
| animation | object / array | null | animate configure parameters |
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " rc-tween-one" ,
3
- "version" : " 2.4.1 " ,
3
+ "version" : " 2.5.0 " ,
4
4
"description" : " tween-one anim component for react" ,
5
5
"keywords" : [
6
6
" react" ,
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class TweenOne extends Component {
47
47
this . updateAnim = false ;
48
48
this . repeatNum = 0 ;
49
49
this . forced = { } ;
50
+ this . currentRef = null ;
50
51
this . setForcedJudg ( props ) ;
51
52
}
52
53
@@ -337,7 +338,13 @@ class TweenOne extends Component {
337
338
const newClassName = props . className ? `${ props . className } ${ className } ` : className ;
338
339
return React . cloneElement ( this . props . children , { style : newStyle , className : newClassName } ) ;
339
340
}
340
- return React . createElement ( this . props . component , { ...props , ...this . props . componentProps } ) ;
341
+ return React . createElement ( this . props . component , {
342
+ ref : ( c ) => {
343
+ this . currentRef = c ;
344
+ } ,
345
+ ...props ,
346
+ ...this . props . componentProps
347
+ } ) ;
341
348
}
342
349
}
343
350
TweenOne . isTweenOne = true ;
Original file line number Diff line number Diff line change @@ -294,8 +294,8 @@ export function getTransformValue(t) {
294
294
const rX = rotateX ? `rotateX(${ rotateX } deg)` : '' ;
295
295
const rY = rotateY ? `rotateY(${ rotateY } deg)` : '' ;
296
296
const per = perspective ? `perspective(${ perspective } px)` : '' ;
297
- const defautlTranslate = ( ss || an || rX || rY || sk ) ? '' : 'translate(0px, 0px)' ;
297
+ const defaultTranslate = ( ss || an || rX || rY || sk ) ? '' : 'translate(0px, 0px)' ;
298
298
const translate = t . translateZ ? `translate3d(${ translateX } ,${ translateY } ,${ translateZ } )` :
299
- ( t . translateX || t . translateY ) && `translate(${ translateX } ,${ translateY } )` || defautlTranslate ;
299
+ ( t . translateX || t . translateY ) && `translate(${ translateX } ,${ translateY } )` || defaultTranslate ;
300
300
return `${ per } ${ translate } ${ ss } ${ an } ${ rX } ${ rY } ${ sk } ` . trim ( ) ;
301
301
}
You can’t perform that action at this time.
0 commit comments