Skip to content

Commit

Permalink
Fix: Cannot resize
Browse files Browse the repository at this point in the history
  • Loading branch information
12joan committed Nov 29, 2023
1 parent 9dd88e8 commit 94502a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/resizable/src/components/Resizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const Resizable = React.forwardRef<
return (
<div ref={wrapperRef} {...wrapperProps}>
<div ref={ref} {...props} {...rest}>
<ResizeHandleProvider onResize={context.onResize}>
<ResizeHandleProvider onResize={{ fn: context.onResize }}>
{children}
</ResizeHandleProvider>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/resizable/src/components/ResizeHandle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { isTouchEvent } from '../utils';

export const { ResizeHandleProvider, useResizeHandleStore } = createAtomStore(
{
onResize: null as ResizeHandleOptions['onResize'] | null,
onResize: null as { fn: ResizeHandleOptions['onResize'] } | null,
},
{ name: 'resizeHandle' }
);
Expand All @@ -39,7 +39,7 @@ export const useResizeHandleState = ({
onHoverEnd,
}: ResizeHandleOptions) => {
const _onResize = useResizeHandleStore().get.onResize();
if (!onResize) onResize = _onResize ?? undefined;
if (!onResize) onResize = _onResize?.fn;

const [isResizing, setIsResizing] = useState(false);
const [initialPosition, setInitialPosition] = useState(0);
Expand Down

0 comments on commit 94502a9

Please sign in to comment.