@@ -115,19 +115,19 @@ class QueueAnim extends React.Component {
115
115
}
116
116
}
117
117
118
- getVelocityConfig ( index ) {
118
+ getVelocityConfig ( index , ... args ) {
119
119
if ( this . props . animConfig ) {
120
- return transformArguments ( this . props . animConfig ) [ index ] ;
120
+ return transformArguments ( this . props . animConfig , ... args ) [ index ] ;
121
121
}
122
- return AnimTypes [ transformArguments ( this . props . type ) [ index ] ] ;
122
+ return AnimTypes [ transformArguments ( this . props . type , ... args ) [ index ] ] ;
123
123
}
124
124
125
- getVelocityEnterConfig ( ) {
126
- return this . getVelocityConfig ( 0 ) ;
125
+ getVelocityEnterConfig ( ... args ) {
126
+ return this . getVelocityConfig ( 0 , ... args ) ;
127
127
}
128
128
129
- getVelocityLeaveConfig ( ) {
130
- const config = this . getVelocityConfig ( 1 ) ;
129
+ getVelocityLeaveConfig ( ... args ) {
130
+ const config = this . getVelocityConfig ( 1 , ... args ) ;
131
131
const ret = { } ;
132
132
Object . keys ( config ) . forEach ( ( key ) => {
133
133
if ( Array . isArray ( config [ key ] ) ) {
@@ -139,8 +139,8 @@ class QueueAnim extends React.Component {
139
139
return ret ;
140
140
}
141
141
142
- getVelocityEasing ( ) {
143
- return transformArguments ( this . props . ease ) . map ( ( easeName ) => {
142
+ getVelocityEasing ( ... args ) {
143
+ return transformArguments ( this . props . ease , ... args ) . map ( ( easeName ) => {
144
144
if ( typeof easeName === 'string' ) {
145
145
return BackEase [ easeName ] || easeName ;
146
146
}
@@ -152,35 +152,35 @@ class QueueAnim extends React.Component {
152
152
if ( ! placeholderNode ) {
153
153
return ;
154
154
}
155
- const interval = transformArguments ( this . props . interval ) [ 0 ] ;
156
- const delay = transformArguments ( this . props . delay ) [ 0 ] ;
155
+ const interval = transformArguments ( this . props . interval , key , i ) [ 0 ] ;
156
+ const delay = transformArguments ( this . props . delay , key , i ) [ 0 ] ;
157
157
placeholderNode . style . visibility = 'hidden' ;
158
158
velocity ( placeholderNode , 'stop' ) ;
159
159
velocity ( placeholderNode , { opacity : [ 0 , 0 ] } , {
160
160
delay : interval * i + delay ,
161
161
duration : 0 ,
162
- begin : this . performEnterBegin . bind ( this , key ) ,
162
+ begin : this . performEnterBegin . bind ( this , key , i ) ,
163
163
} ) ;
164
164
if ( this . keysToEnter . indexOf ( key ) >= 0 ) {
165
165
this . keysToEnter . splice ( this . keysToEnter . indexOf ( key ) , 1 ) ;
166
166
}
167
167
}
168
168
169
- performEnterBegin ( key ) {
169
+ performEnterBegin ( key , i ) {
170
170
const childrenShow = this . state . childrenShow ;
171
171
childrenShow [ key ] = true ;
172
- this . setState ( { childrenShow } , this . realPerformEnter . bind ( this , key ) ) ;
172
+ this . setState ( { childrenShow } , this . realPerformEnter . bind ( this , key , i ) ) ;
173
173
}
174
174
175
- realPerformEnter ( key ) {
175
+ realPerformEnter ( key , i ) {
176
176
const node = findDOMNode ( this . refs [ key ] ) ;
177
177
if ( ! node ) {
178
178
return ;
179
179
}
180
- const duration = transformArguments ( this . props . duration ) [ 0 ] ;
180
+ const duration = transformArguments ( this . props . duration , key , i ) [ 0 ] ;
181
181
node . style . visibility = 'hidden' ;
182
182
velocity ( node , 'stop' ) ;
183
- velocity ( node , this . getVelocityEnterConfig ( 'enter' ) , {
183
+ velocity ( node , this . getVelocityEnterConfig ( key , i ) , {
184
184
duration : duration ,
185
185
easing : this . getVelocityEasing ( ) [ 0 ] ,
186
186
visibility : 'visible' ,
@@ -194,12 +194,12 @@ class QueueAnim extends React.Component {
194
194
if ( ! node ) {
195
195
return ;
196
196
}
197
- const interval = transformArguments ( this . props . interval ) [ 1 ] ;
198
- const delay = transformArguments ( this . props . delay ) [ 1 ] ;
199
- const duration = transformArguments ( this . props . duration ) [ 1 ] ;
197
+ const interval = transformArguments ( this . props . interval , key , i ) [ 1 ] ;
198
+ const delay = transformArguments ( this . props . delay , key , i ) [ 1 ] ;
199
+ const duration = transformArguments ( this . props . duration , key , i ) [ 1 ] ;
200
200
const order = this . props . leaveReverse ? ( this . keysToLeave . length - i - 1 ) : i ;
201
201
velocity ( node , 'stop' ) ;
202
- velocity ( node , this . getVelocityLeaveConfig ( 'leave' ) , {
202
+ velocity ( node , this . getVelocityLeaveConfig ( key , i ) , {
203
203
delay : interval * order + delay ,
204
204
duration : duration ,
205
205
easing : this . getVelocityEasing ( ) [ 1 ] ,
@@ -271,14 +271,18 @@ class QueueAnim extends React.Component {
271
271
const numberOrArray = React . PropTypes . oneOfType ( [ React . PropTypes . number , React . PropTypes . array ] ) ;
272
272
const stringOrArray = React . PropTypes . oneOfType ( [ React . PropTypes . string , React . PropTypes . array ] ) ;
273
273
const objectOrArray = React . PropTypes . oneOfType ( [ React . PropTypes . object , React . PropTypes . array ] ) ;
274
+ const funcOrStringOrArray = React . PropTypes . oneOfType ( [ React . PropTypes . func , stringOrArray ] ) ;
275
+ const funcOrObjectOrArray = React . PropTypes . oneOfType ( [ React . PropTypes . func , objectOrArray ] ) ;
276
+ const funcOrNumberOrArray = React . PropTypes . oneOfType ( [ React . PropTypes . func , numberOrArray ] ) ;
277
+
274
278
QueueAnim . propTypes = {
275
279
component : React . PropTypes . string ,
276
280
interval : numberOrArray ,
277
- duration : numberOrArray ,
278
- delay : numberOrArray ,
279
- type : stringOrArray ,
280
- animConfig : objectOrArray ,
281
- ease : stringOrArray ,
281
+ duration : funcOrNumberOrArray ,
282
+ delay : funcOrNumberOrArray ,
283
+ type : funcOrStringOrArray ,
284
+ animConfig : funcOrObjectOrArray ,
285
+ ease : funcOrStringOrArray ,
282
286
leaveReverse : React . PropTypes . bool ,
283
287
animatingClassName : React . PropTypes . array ,
284
288
} ;
0 commit comments