@@ -247,12 +247,16 @@ class Carousel extends React.Component {
247247 } , cb )
248248 }
249249
250- prepareSiblingFrames ( ) {
251- const siblings = {
250+ getSiblingFrames ( ) {
251+ return {
252252 current : this . refs [ 'f' + this . getFrameId ( ) ] ,
253253 prev : this . refs [ 'f' + this . getFrameId ( 'prev' ) ] ,
254254 next : this . refs [ 'f' + this . getFrameId ( 'next' ) ]
255255 }
256+ }
257+
258+ prepareSiblingFrames ( ) {
259+ const siblings = this . getSiblingFrames ( )
256260
257261 if ( ! this . props . loop ) {
258262 this . state . current === 0 && ( siblings . prev = undefined )
@@ -289,7 +293,7 @@ class Carousel extends React.Component {
289293
290294 transitFramesTowards ( direction ) {
291295 const { prev, current, next } = this . state . movingFrames
292- const { duration, axis } = this . props
296+ const { duration, axis, onTransitionEnd } = this . props
293297
294298 let newCurrentId = this . state . current
295299 switch ( direction ) {
@@ -324,6 +328,8 @@ class Carousel extends React.Component {
324328 }
325329 }
326330
331+ onTransitionEnd && setTimeout ( ( ) => onTransitionEnd ( this . getSiblingFrames ( ) ) , duration )
332+
327333 this . setState ( { current : newCurrentId } )
328334 }
329335
@@ -382,7 +388,8 @@ Carousel.propTypes = {
382388 widgets : PropTypes . arrayOf ( PropTypes . func ) ,
383389 frames : PropTypes . arrayOf ( PropTypes . element ) ,
384390 style : PropTypes . object ,
385- minMove : PropTypes . number
391+ minMove : PropTypes . number ,
392+ onTransitionEnd : PropTypes . func
386393}
387394
388395Carousel . defaultProps = {
0 commit comments