@@ -14,52 +14,52 @@ interface IFileListProps extends IOptions {
1414}
1515
1616const LunaFileList : FC < IFileListProps > = ( props ) => {
17- const fileListRef = useRef < HTMLDivElement > ( null )
18- const fileList = useRef < FileList > ( )
17+ const containerRef = useRef < HTMLDivElement > ( null )
18+ const fileListRef = useRef < FileList > ( )
1919 const prevProps = usePrevious ( props )
2020
2121 useEffect ( ( ) => {
22- fileList . current = new FileList ( fileListRef . current ! , {
22+ fileListRef . current = new FileList ( containerRef . current ! , {
2323 files : props . files ,
2424 listView : props . listView ,
2525 filter : props . filter ,
2626 columns : props . columns ,
2727 theme : props . theme ,
2828 } )
2929
30- return ( ) => fileList . current ?. destroy ( )
30+ return ( ) => fileListRef . current ?. destroy ( )
3131 } , [ ] )
3232
33- useEvent < FileList > ( fileList , 'select' , prevProps ?. onSelect , props . onSelect )
33+ useEvent < FileList > ( fileListRef , 'select' , prevProps ?. onSelect , props . onSelect )
3434 useEvent < FileList > (
35- fileList ,
35+ fileListRef ,
3636 'deselect' ,
3737 prevProps ?. onDeselect ,
3838 props . onDeselect
3939 )
40- useEvent < FileList > ( fileList , 'click' , prevProps ?. onClick , props . onClick )
40+ useEvent < FileList > ( fileListRef , 'click' , prevProps ?. onClick , props . onClick )
4141 useEvent < FileList > (
42- fileList ,
42+ fileListRef ,
4343 'dblclick' ,
4444 prevProps ?. onDoubleClick ,
4545 props . onDoubleClick
4646 )
4747 useEvent < FileList > (
48- fileList ,
48+ fileListRef ,
4949 'contextmenu' ,
5050 prevProps ?. onContextMenu ,
5151 props . onContextMenu
5252 )
5353
5454 each ( [ 'theme' , 'filter' , 'files' , 'listView' ] , ( key : keyof IOptions ) => {
55- useOption < FileList , IOptions > ( fileList , key , props [ key ] )
55+ useOption < FileList , IOptions > ( fileListRef , key , props [ key ] )
5656 } )
5757
5858 return (
5959 < div
6060 className = { props . className || '' }
6161 style = { props . style }
62- ref = { fileListRef }
62+ ref = { containerRef }
6363 />
6464 )
6565}
0 commit comments