Skip to content

Commit

Permalink
Pass onRenderItem to onRenderContainer in the Dropdown component (#25255
Browse files Browse the repository at this point in the history
)

* Pass onRenderItem to onRenderContainer

* Change file
  • Loading branch information
alice-ep authored Oct 20, 2022
1 parent 59cc34e commit 3757c89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Pass onRenderItem to Dropdown's onRenderContainer to allow use of onRenderList with default or custom onRenderItem",
"packageName": "@fluentui/react",
"email": "aepshtein@microsoft.com",
"dependentChangeType": "patch"
}
11 changes: 10 additions & 1 deletion packages/react/src/components/Dropdown/Dropdown.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ class DropdownInternal extends React.Component<IDropdownInternalProps, IDropdown
onRenderContainer = this._onRenderContainer,
onRenderCaretDown = this._onRenderCaretDown,
onRenderLabel = this._onRenderLabel,
onRenderItem = this._onRenderItem,
hoisted: { selectedIndices },
} = props;
const { isOpen, calloutRenderEdge, hasFocus } = this.state;
Expand Down Expand Up @@ -397,7 +398,15 @@ class DropdownInternal extends React.Component<IDropdownInternalProps, IDropdown
</span>
<span className={this._classNames.caretDownWrapper}>{onRenderCaretDown(props, this._onRenderCaretDown)}</span>
</div>
{isOpen && onRenderContainer({ ...props, onDismiss: this._onDismiss }, this._onRenderContainer)}
{isOpen &&
onRenderContainer(
{
...props,
onDismiss: this._onDismiss,
onRenderItem,
},
this._onRenderContainer,
)}
{hasErrorMessage && (
<div role="alert" id={errorMessageId} className={this._classNames.errorMessage}>
{errorMessage}
Expand Down

0 comments on commit 3757c89

Please sign in to comment.