@@ -38,7 +38,7 @@ const MOTION_PROP_NAMES = [
3838] ;
3939
4040export interface CSSMotionListProps
41- extends Omit < CSSMotionProps , 'onVisibleChanged' > ,
41+ extends Omit < CSSMotionProps , 'onVisibleChanged' | 'children' > ,
4242 Omit < React . HTMLAttributes < any > , 'children' > {
4343 keys : ( React . Key | { key : React . Key ; [ name : string ] : any } ) [ ] ;
4444 component ?: string | React . ComponentType | false ;
@@ -47,6 +47,16 @@ export interface CSSMotionListProps
4747 onVisibleChanged ?: ( visible : boolean , info : { key : React . Key } ) => void ;
4848 /** All motion leaves in the screen */
4949 onAllRemoved ?: ( ) => void ;
50+ children ?: (
51+ props : {
52+ visible ?: boolean ;
53+ className ?: string ;
54+ style ?: React . CSSProperties ;
55+ index ?: number ;
56+ [ key : string ] : any ;
57+ } ,
58+ ref : ( node : any ) => void ,
59+ ) => React . ReactElement ;
5060}
5161
5262export interface CSSMotionListState {
@@ -138,7 +148,7 @@ export function genCSSMotionList(
138148
139149 return (
140150 < Component { ...restProps } >
141- { keyEntities . map ( ( { status, ...eventProps } ) => {
151+ { keyEntities . map ( ( { status, ...eventProps } , index ) => {
142152 const visible = status === STATUS_ADD || status === STATUS_KEEP ;
143153 return (
144154 < CSSMotion
@@ -158,7 +168,7 @@ export function genCSSMotionList(
158168 }
159169 } }
160170 >
161- { children }
171+ { ( props , ref ) => children ( { ... props , index } , ref ) }
162172 </ CSSMotion >
163173 ) ;
164174 } ) }
0 commit comments