@@ -11,6 +11,7 @@ import {
1111 parseKeys ,
1212 KeyObject ,
1313} from './util/diff' ;
14+ import { ListMotionEndEventHandler } from './interface' ;
1415
1516const MOTION_PROP_NAMES = [
1617 'eventProps' ,
@@ -35,9 +36,10 @@ const MOTION_PROP_NAMES = [
3536 'onLeaveEnd' ,
3637] ;
3738
38- export interface CSSMotionListProps extends CSSMotionProps {
39+ export interface CSSMotionListProps extends Omit < CSSMotionProps , 'onLeaveEnd' > {
3940 keys : ( React . Key | { key : React . Key ; [ name : string ] : any } ) [ ] ;
4041 component ?: string | React . ComponentType | false ;
42+ onLeaveEnd ?: ListMotionEndEventHandler ;
4143}
4244
4345export interface CSSMotionListState {
@@ -118,7 +120,7 @@ export function genCSSMotionList(
118120
119121 render ( ) {
120122 const { keyEntities } = this . state ;
121- const { component, children, ...restProps } = this . props ;
123+ const { component, children, onLeaveEnd , ...restProps } = this . props ;
122124
123125 const Component = component || React . Fragment ;
124126
@@ -140,8 +142,8 @@ export function genCSSMotionList(
140142 visible = { visible }
141143 eventProps = { eventProps }
142144 onLeaveEnd = { ( ...args ) => {
143- if ( motionProps . onLeaveEnd ) {
144- motionProps . onLeaveEnd ( ...args ) ;
145+ if ( onLeaveEnd ) {
146+ onLeaveEnd ( ...args , { key : eventProps . key } ) ;
145147 }
146148 this . removeKey ( eventProps . key ) ;
147149 } }
0 commit comments