From bd2afef2364c130cbae9677771fc403cfc850352 Mon Sep 17 00:00:00 2001 From: Shea Janke Date: Tue, 26 May 2026 12:04:29 -0700 Subject: [PATCH] fix: Reduce the required props for ResizableBox * The only required props for ResizableBox should be height, width, and children. Previously the keys from DefaultProps were required as well. --- __tests__/ResizableBox.test.tsx | 12 ++++++++++++ lib/propTypes.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/__tests__/ResizableBox.test.tsx b/__tests__/ResizableBox.test.tsx index 33406f8d..b168af73 100644 --- a/__tests__/ResizableBox.test.tsx +++ b/__tests__/ResizableBox.test.tsx @@ -263,6 +263,18 @@ describe('render ResizableBox', () => { }); }); + test('renders with only width and height (all DefaultProps optional)', () => { + const {container} = render( + + + + ); + const divElement = container.querySelector('div'); + expect(divElement).toHaveStyle({ width: '200px', height: '100px' }); + // Default 'se' handle should be present + expect(container.querySelector('.react-resizable-handle-se')).toBeInTheDocument(); + }); + describe('DOM updates after resize', () => { test('DOM width and height update after resize', async () => { const boxRef = React.createRef(); diff --git a/lib/propTypes.ts b/lib/propTypes.ts index 7bd84baf..d0b58c4b 100644 --- a/lib/propTypes.ts +++ b/lib/propTypes.ts @@ -46,7 +46,7 @@ export type ResizeHandleFn = ( ref: React.RefObject, ) => React.ReactElement; -export type Props = DefaultProps & { +export type Props = Partial & { children: React.ReactElement; className?: string | null; draggableOpts?: Partial> | null;