import * as React from 'react'; import { useCallback } from 'react'; import { _ } from '@joplin/lib/locale'; import CommandService from '@joplin/lib/services/CommandService'; interface Props { selectedIndex: number; onKeyDown: React.KeyboardEventHandler; } const onAddFolderButtonClick = () => { void CommandService.instance().execute('newFolder'); }; const NewFolderButton = () => { // To allow it to be accessed by accessibility tools, the new folder button // is not included in the portion of the list with role='tree'. return ; }; const useOnRenderListWrapper = ({ selectedIndex, onKeyDown }: Props) => { return useCallback((listItems: React.ReactNode[]) => { const listHasValidSelection = selectedIndex >= 0; const allowContainerFocus = !listHasValidSelection; return <>
{...listItems}
; }, [selectedIndex, onKeyDown]); }; export default useOnRenderListWrapper;