Skip to content

Commit

Permalink
feat: add ref Forwarding to NavDropdown (#4626)
Browse files Browse the repository at this point in the history
* update table to forwardRef

* rearrange props

* updates dropdown for ref forward

* add displayName

* Delete package-lock.json
  • Loading branch information
DoctorHowser authored and jquense committed Oct 17, 2019
1 parent 947e42f commit be52005
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/NavDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ const propTypes = {
bsPrefix: PropTypes.string,
};

class NavDropdown extends React.Component {
render() {
const {
const NavDropdown = React.forwardRef(
(
{
id,
title,
children,
Expand All @@ -51,29 +51,29 @@ class NavDropdown extends React.Component {
disabled,
active,
...props
} = this.props;
},
ref,
) => (
<Dropdown ref={ref} {...props} as={NavItem}>
<Dropdown.Toggle
id={id}
eventKey={null}
active={active}
disabled={disabled}
childBsPrefix={bsPrefix}
as={NavLink}
>
{title}
</Dropdown.Toggle>

return (
<Dropdown {...props} as={NavItem}>
<Dropdown.Toggle
id={id}
eventKey={null}
active={active}
disabled={disabled}
childBsPrefix={bsPrefix}
as={NavLink}
>
{title}
</Dropdown.Toggle>

<Dropdown.Menu role={menuRole} rootCloseEvent={rootCloseEvent}>
{children}
</Dropdown.Menu>
</Dropdown>
);
}
}
<Dropdown.Menu role={menuRole} rootCloseEvent={rootCloseEvent}>
{children}
</Dropdown.Menu>
</Dropdown>
),
);

NavDropdown.displayName = 'NavDropdown';
NavDropdown.propTypes = propTypes;
NavDropdown.Item = Dropdown.Item;
NavDropdown.Divider = Dropdown.Divider;
Expand Down

0 comments on commit be52005

Please sign in to comment.