diff --git a/src/allotment.tsx b/src/allotment.tsx index 5507cc5f..d3483ca3 100644 --- a/src/allotment.tsx +++ b/src/allotment.tsx @@ -118,10 +118,10 @@ const Allotment = forwardRef( const options: SplitViewOptions = { orientation: vertical ? Orientation.Vertical : Orientation.Horizontal, ...(initializeSizes && - sizes && { + defaultSizes && { descriptor: { - size: sizes.reduce((a, b) => a + b, 0), - views: sizes.map((size, index) => ({ + size: defaultSizes.reduce((a, b) => a + b, 0), + views: defaultSizes.map((size, index) => ({ container: [...splitViewViewRef.current.values()][index], size: size, view: { diff --git a/stories/allotment.stories.tsx b/stories/allotment.stories.tsx index 0ce3ac99..efeb440c 100644 --- a/stories/allotment.stories.tsx +++ b/stories/allotment.stories.tsx @@ -208,3 +208,15 @@ export const Reset: Story = (args) => { ); }; Reset.args = {}; + +export const DefaultSize: Story = () => { + return ( +
+ +
div1
+
div2
+
+
+ ); +}; +DefaultSize.args = {};