Skip to content

Commit

Permalink
fix: use custom onReset callback for programatic reset
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwalley committed Apr 11, 2022
1 parent 7e3fa57 commit 978c0be
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/allotment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,14 @@ const Allotment = forwardRef<AllotmentHandle, AllotmentProps>(

useImperativeHandle(ref, () => ({
reset: () => {
splitViewRef.current?.distributeViewSizes();
if (onReset) {
onReset();
} else {
splitViewRef.current?.distributeViewSizes();

for (let index = 0; index < views.current.length; index++) {
resizeToPreferredSize(index);
for (let index = 0; index < views.current.length; index++) {
resizeToPreferredSize(index);
}
}
},
resize: (sizes) => {
Expand Down

0 comments on commit 978c0be

Please sign in to comment.