@@ -10,7 +10,6 @@ import type {
10
10
} from 'rc-trigger/lib/interface' ;
11
11
import Placements from './placements' ;
12
12
import useAccessibility from './hooks/useAccessibility' ;
13
- import { composeRef , supportRef } from 'rc-util/lib/ref' ;
14
13
15
14
export interface DropdownProps
16
15
extends Pick <
@@ -70,14 +69,10 @@ function Dropdown(props: DropdownProps, ref) {
70
69
const triggerRef = React . useRef ( null ) ;
71
70
React . useImperativeHandle ( ref , ( ) => triggerRef . current ) ;
72
71
73
- const menuRef = React . useRef ( null ) ;
74
- const menuClassName = `${ prefixCls } -menu` ;
75
-
76
72
useAccessibility ( {
77
73
visible : mergedVisible ,
78
74
setTriggerVisible,
79
75
triggerRef,
80
- menuRef,
81
76
onVisibleChange : props . onVisibleChange ,
82
77
autoFocus,
83
78
} ) ;
@@ -95,15 +90,12 @@ function Dropdown(props: DropdownProps, ref) {
95
90
96
91
const onClick = ( e ) => {
97
92
const { onOverlayClick } = props ;
98
- const overlayProps = getOverlayElement ( ) . props ;
99
93
setTriggerVisible ( false ) ;
100
94
95
+ console . log ( '!!!!!!!!!!!!' , onOverlayClick ) ;
101
96
if ( onOverlayClick ) {
102
97
onOverlayClick ( e ) ;
103
98
}
104
- if ( overlayProps . onClick ) {
105
- overlayProps . onClick ( e ) ;
106
- }
107
99
} ;
108
100
109
101
const onVisibleChange = ( newVisible : boolean ) => {
@@ -116,23 +108,11 @@ function Dropdown(props: DropdownProps, ref) {
116
108
117
109
const getMenuElement = ( ) => {
118
110
const overlayElement = getOverlayElement ( ) ;
119
- // @ts -ignore
120
- const composedMenuRef = composeRef ( menuRef , overlayElement . ref ) ;
121
-
122
- const extraOverlayProps = {
123
- prefixCls : menuClassName ,
124
- [ 'data-dropdown-inject' ] : true ,
125
- onClick,
126
- ref : supportRef ( overlayElement ) ? composedMenuRef : undefined ,
127
- } ;
128
- if ( typeof overlayElement . type === 'string' ) {
129
- delete extraOverlayProps . prefixCls ;
130
- delete extraOverlayProps [ 'data-dropdown-inject' ] ;
131
- }
111
+
132
112
return (
133
113
< >
134
114
{ arrow && < div className = { `${ prefixCls } -arrow` } /> }
135
- { React . cloneElement ( overlayElement , extraOverlayProps ) }
115
+ { overlayElement }
136
116
</ >
137
117
) ;
138
118
} ;
@@ -199,6 +179,7 @@ function Dropdown(props: DropdownProps, ref) {
199
179
stretch = { getMinOverlayWidthMatchTrigger ( ) ? 'minWidth' : '' }
200
180
popup = { getMenuElementOrLambda ( ) }
201
181
onPopupVisibleChange = { onVisibleChange }
182
+ onPopupClick = { onClick }
202
183
getPopupContainer = { getPopupContainer }
203
184
>
204
185
{ renderChildren ( ) }
0 commit comments