@@ -60,6 +60,8 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r
60
60
listHeight,
61
61
listItemHeight,
62
62
optionRender,
63
+ classNames : contextClassNames ,
64
+ styles : contextStyles ,
63
65
} = React . useContext ( SelectContext ) ;
64
66
65
67
const itemPrefixCls = `${ prefixCls } -item` ;
@@ -327,6 +329,8 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r
327
329
direction = { direction }
328
330
innerProps = { virtual ? null : a11yProps }
329
331
showScrollBar = { showScrollBar }
332
+ className = { contextClassNames ?. list }
333
+ style = { contextStyles ?. list }
330
334
>
331
335
{ ( item , itemIndex ) => {
332
336
const { group, groupOption, data, label, value } = item ;
@@ -355,12 +359,18 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r
355
359
const mergedDisabled = disabled || ( ! selected && overMaxCount ) ;
356
360
357
361
const optionPrefixCls = `${ itemPrefixCls } -option` ;
358
- const optionClassName = classNames ( itemPrefixCls , optionPrefixCls , className , {
359
- [ `${ optionPrefixCls } -grouped` ] : groupOption ,
360
- [ `${ optionPrefixCls } -active` ] : activeIndex === itemIndex && ! mergedDisabled ,
361
- [ `${ optionPrefixCls } -disabled` ] : mergedDisabled ,
362
- [ `${ optionPrefixCls } -selected` ] : selected ,
363
- } ) ;
362
+ const optionClassName = classNames (
363
+ itemPrefixCls ,
364
+ optionPrefixCls ,
365
+ className ,
366
+ contextClassNames ?. listItem ,
367
+ {
368
+ [ `${ optionPrefixCls } -grouped` ] : groupOption ,
369
+ [ `${ optionPrefixCls } -active` ] : activeIndex === itemIndex && ! mergedDisabled ,
370
+ [ `${ optionPrefixCls } -disabled` ] : mergedDisabled ,
371
+ [ `${ optionPrefixCls } -selected` ] : selected ,
372
+ } ,
373
+ ) ;
364
374
365
375
const mergedLabel = getLabel ( item ) ;
366
376
@@ -393,7 +403,7 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r
393
403
onSelectValue ( value ) ;
394
404
}
395
405
} }
396
- style = { style }
406
+ style = { { ... contextStyles ?. listItem , ... style } }
397
407
>
398
408
< div className = { `${ optionPrefixCls } -content` } >
399
409
{ typeof optionRender === 'function'
0 commit comments