Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/DrawerPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { clsx } from 'clsx';
import type { CSSMotionProps } from '@rc-component/motion';
import CSSMotion from '@rc-component/motion';
import pickAttrs from '@rc-component/util/lib/pickAttrs';
import { fillRef } from '@rc-component/util/lib/ref';
import * as React from 'react';
import type { DrawerContextProps } from './context';
import DrawerContext from './context';
Expand Down Expand Up @@ -303,6 +304,14 @@ const DrawerPopup: React.ForwardRefRenderFunction<
onResizeEnd: resizeConfig.onResizeEnd,
});

const mergeRefs = React.useCallback(
(motionRef: React.Ref<HTMLDivElement>) => (node: HTMLDivElement) => {
wrapperRef.current = node;
fillRef(motionRef, node);
},
[],
);

// =========================== Events ===========================
const eventHandlers = {
onMouseEnter,
Expand Down Expand Up @@ -332,7 +341,6 @@ const DrawerPopup: React.ForwardRefRenderFunction<
const content = (
<DrawerPanel
id={id}
containerRef={motionRef}
prefixCls={prefixCls}
className={clsx(className, drawerClassNames?.section)}
style={{ ...style, ...styles?.section }}
Expand All @@ -344,7 +352,7 @@ const DrawerPopup: React.ForwardRefRenderFunction<
);
return (
<div
ref={wrapperRef}
ref={mergeRefs(motionRef)}
className={clsx(
`${prefixCls}-content-wrapper`,
isDragging && `${prefixCls}-content-wrapper-dragging`,
Expand Down