33import * as React from 'react' ;
44// @ts -ignore
55import CSSMotion from 'rc-animate/lib/CSSMotion' ;
6- import classNames from 'classnames ' ;
6+ import { clsx } from 'clsx ' ;
77import List , { ListRef } from '../src/List' ;
8- import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect' ;
8+ import useLayoutEffect from '@ rc-component/ util/lib/hooks/useLayoutEffect' ;
99import './animate.less' ;
1010
1111let uuid = 0 ;
@@ -74,7 +74,7 @@ const MyItem: React.ForwardRefRenderFunction<any, MyItemProps> = (
7474 motionName = "motion"
7575 motionAppear = { motionAppear }
7676 onAppearStart = { getCollapsedHeight }
77- onAppearActive = { node => {
77+ onAppearActive = { ( node ) => {
7878 motionRef . current = true ;
7979 return getMaxHeight ( node ) ;
8080 } }
@@ -87,12 +87,7 @@ const MyItem: React.ForwardRefRenderFunction<any, MyItemProps> = (
8787 >
8888 { ( { className, style } , passedMotionRef ) => {
8989 return (
90- < div
91- ref = { passedMotionRef }
92- className = { classNames ( 'item' , className ) }
93- style = { style }
94- data-id = { id }
95- >
90+ < div ref = { passedMotionRef } className = { clsx ( 'item' , className ) } style = { style } data-id = { id } >
9691 < div style = { { height : itemUuid % 2 ? 100 : undefined } } >
9792 < button
9893 type = "button"
@@ -145,7 +140,7 @@ const Demo = () => {
145140 } ;
146141
147142 const onLeave = ( id : string ) => {
148- const newData = data . filter ( item => item . id !== id ) ;
143+ const newData = data . filter ( ( item ) => item . id !== id ) ;
149144 setData ( newData ) ;
150145 } ;
151146
@@ -159,14 +154,14 @@ const Demo = () => {
159154 }
160155
161156 const onInsertBefore = ( id : string ) => {
162- const index = data . findIndex ( item => item . id === id ) ;
157+ const index = data . findIndex ( ( item ) => item . id === id ) ;
163158 const newData = [ ...data . slice ( 0 , index ) , genItem ( ) , ...data . slice ( index ) ] ;
164159 setInsertIndex ( index ) ;
165160 setData ( newData ) ;
166161 lockForAnimation ( ) ;
167162 } ;
168163 const onInsertAfter = ( id : string ) => {
169- const index = data . findIndex ( item => item . id === id ) + 1 ;
164+ const index = data . findIndex ( ( item ) => item . id === id ) + 1 ;
170165 const newData = [ ...data . slice ( 0 , index ) , genItem ( ) , ...data . slice ( index ) ] ;
171166 setInsertIndex ( index ) ;
172167 setData ( newData ) ;
0 commit comments