@@ -20,9 +20,7 @@ class Dropdown extends Util.mixin(BindMixin) {
20
20
"handleExternalClick" ,
21
21
"handleKeyDown" ,
22
22
"handleMenuRender" ,
23
- "handleWrapperBlur" ,
24
- "setDropdownMenuRef" ,
25
- "setDropdownWrapperRef"
23
+ "handleWrapperBlur"
26
24
] ;
27
25
}
28
26
@@ -38,6 +36,8 @@ class Dropdown extends Util.mixin(BindMixin) {
38
36
renderHidden : false ,
39
37
selectedID : null
40
38
} ;
39
+ this . dropdownMenuRef = React . createRef ( ) ;
40
+ this . dropdownWrapperRef = React . createRef ( ) ;
41
41
}
42
42
43
43
componentWillMount ( ) {
@@ -161,7 +161,7 @@ class Dropdown extends Util.mixin(BindMixin) {
161
161
let menuDirection = this . state . menuDirection ;
162
162
const menuPositionStyle = { } ;
163
163
const spaceAroundDropdownButton = DOMUtil . getNodeClearance (
164
- this . dropdownWrapperRef
164
+ this . dropdownWrapperRef . current
165
165
) ;
166
166
const dropdownChildHeight =
167
167
this . dropdownMenuRef && this . dropdownMenuRef . current
@@ -174,7 +174,6 @@ class Dropdown extends Util.mixin(BindMixin) {
174
174
const isMenuShorterThanTop = ! isMenuTallerThanTop ;
175
175
const isTopTallerThanBottom =
176
176
spaceAroundDropdownButton . top > spaceAroundDropdownButton . bottom ;
177
-
178
177
// If the menu height is larger than the space available on the bottom and
179
178
// less than the space available on top, then render it up. If the height
180
179
// of the menu exceeds the space below and above, but there is more space
@@ -317,14 +316,6 @@ class Dropdown extends Util.mixin(BindMixin) {
317
316
) ;
318
317
}
319
318
320
- setDropdownMenuRef ( element ) {
321
- this . dropdownMenuRef = element ;
322
- }
323
-
324
- setDropdownWrapperRef ( element ) {
325
- this . dropdownWrapperRef = element ;
326
- }
327
-
328
319
render ( ) {
329
320
// Set a key based on the menu height so that React knows to keep the
330
321
// the DOM element around while we are measuring it.
@@ -386,7 +377,7 @@ class Dropdown extends Util.mixin(BindMixin) {
386
377
key = "dropdown-menu-key"
387
378
className = { dropdownMenuClassSet }
388
379
role = "menu"
389
- ref = { this . setDropdownMenuRef }
380
+ ref = { this . dropdownMenuRef }
390
381
style = { state . menuPositionStyle }
391
382
>
392
383
< div className = { props . dropdownMenuListClassName } >
@@ -396,18 +387,16 @@ class Dropdown extends Util.mixin(BindMixin) {
396
387
) ;
397
388
}
398
389
399
- // if (state.renderHidden) {
400
- // dropdownMenu = (
401
- // <div key="concealer" className="dropdown-menu-concealer">
402
- // {dropdownMenu}
403
- // </div>
404
- // );
405
- // }
406
-
407
- if ( props . transition ) {
390
+ if ( state . renderHidden ) {
391
+ dropdownMenu = (
392
+ < div key = "concealer" className = "dropdown-menu-concealer" >
393
+ { dropdownMenu }
394
+ </ div >
395
+ ) ;
396
+ } else if ( props . transition ) {
408
397
dropdownMenu = (
409
398
< CSSTransition
410
- in = { state . isOpen && ! state . renderHidden }
399
+ in = { state . isOpen }
411
400
classNames = { transitionName }
412
401
timeout = { {
413
402
enter : props . transitionEnterTimeout ,
@@ -424,7 +413,7 @@ class Dropdown extends Util.mixin(BindMixin) {
424
413
className = { wrapperClassSet }
425
414
tabIndex = "1"
426
415
onBlur = { this . handleWrapperBlur }
427
- ref = { this . setDropdownWrapperRef }
416
+ ref = { this . dropdownWrapperRef }
428
417
>
429
418
{ React . cloneElement ( trigger , {
430
419
selectedItem : this . getSelectedItem ( this . getSelectedID ( ) , items ) ,
0 commit comments