@@ -161,6 +161,7 @@ const Select = React.forwardRef(
161
161
// Select
162
162
onSelect,
163
163
onDeselect,
164
+ dropdownMatchSelectWidth,
164
165
165
166
// Options
166
167
filterOption,
@@ -547,8 +548,9 @@ const Select = React.forwardRef(
547
548
} ;
548
549
549
550
// ========================== Context ===========================
550
- const selectContext = React . useMemo (
551
- ( ) => ( {
551
+ const selectContext = React . useMemo ( ( ) => {
552
+ const realVirtual = virtual !== false && dropdownMatchSelectWidth !== false ;
553
+ return {
552
554
...parsedOptions ,
553
555
flattenOptions : displayOptions ,
554
556
onActiveValue,
@@ -557,26 +559,26 @@ const Select = React.forwardRef(
557
559
menuItemSelectedIcon,
558
560
rawValues,
559
561
fieldNames : mergedFieldNames ,
560
- virtual,
561
- listHeight,
562
- listItemHeight,
563
- childrenAsData,
564
- } ) ,
565
- [
566
- parsedOptions ,
567
- displayOptions ,
568
- onActiveValue ,
569
- mergedDefaultActiveFirstOption ,
570
- onInternalSelect ,
571
- menuItemSelectedIcon ,
572
- rawValues ,
573
- mergedFieldNames ,
574
- virtual ,
562
+ virtual : realVirtual ,
575
563
listHeight,
576
564
listItemHeight,
577
565
childrenAsData,
578
- ] ,
579
- ) ;
566
+ } ;
567
+ } , [
568
+ parsedOptions ,
569
+ displayOptions ,
570
+ onActiveValue ,
571
+ mergedDefaultActiveFirstOption ,
572
+ onInternalSelect ,
573
+ menuItemSelectedIcon ,
574
+ rawValues ,
575
+ mergedFieldNames ,
576
+ virtual ,
577
+ dropdownMatchSelectWidth ,
578
+ listHeight ,
579
+ listItemHeight ,
580
+ childrenAsData ,
581
+ ] ) ;
580
582
581
583
// ========================== Warning ===========================
582
584
if ( process . env . NODE_ENV !== 'production' ) {
@@ -603,6 +605,7 @@ const Select = React.forwardRef(
603
605
searchValue = { mergedSearchValue }
604
606
onSearch = { onInternalSearch }
605
607
onSearchSplit = { onInternalSearchSplit }
608
+ dropdownMatchSelectWidth = { dropdownMatchSelectWidth }
606
609
// >>> OptionList
607
610
OptionList = { OptionList }
608
611
emptyOptions = { ! displayOptions . length }
0 commit comments