@@ -5,6 +5,7 @@ import type { CSSMotionProps } from 'rc-motion';
55import type { DrawerPanelRef } from './DrawerPanel' ;
66import DrawerPanel from './DrawerPanel' ;
77import type ScrollLocker from 'rc-util/lib/Dom/scrollLocker' ;
8+ import { composeRef } from 'rc-util/lib/ref' ;
89import DrawerContext from './context' ;
910import type { DrawerContextProps } from './context' ;
1011
@@ -180,7 +181,10 @@ export default function DrawerPopup(props: DrawerPopupProps) {
180181 // ============================ Mask ============================
181182 const maskNode : React . ReactNode = mask && (
182183 < CSSMotion key = "mask" { ...maskMotion } visible = { open } >
183- { ( { className : motionMaskClassName , style : motionMaskStyle } ) => {
184+ { (
185+ { className : motionMaskClassName , style : motionMaskStyle } ,
186+ maskRef ,
187+ ) => {
184188 return (
185189 < div
186190 className = { classNames (
@@ -194,6 +198,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
194198 ...zIndexStyle ,
195199 } }
196200 onClick = { maskClosable && onClose }
201+ ref = { maskRef }
197202 />
198203 ) ;
199204 } }
@@ -245,10 +250,10 @@ export default function DrawerPopup(props: DrawerPopupProps) {
245250 removeOnLeave = { false }
246251 leavedClassName = { `${ prefixCls } -content-hidden` }
247252 >
248- { ( { className : motionClassName , style : motionStyle } ) => {
253+ { ( { className : motionClassName , style : motionStyle } , motionRef ) => {
249254 return (
250255 < DrawerPanel
251- ref = { panelRef }
256+ ref = { composeRef ( motionRef , panelRef ) }
252257 prefixCls = { prefixCls }
253258 className = { classNames ( className , motionClassName ) }
254259 style = { {
0 commit comments