Skip to content

Commit

Permalink
fix: Allow falsy eventKeys in DropdownItem and ListGroupItem (#5404)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Aug 26, 2020
1 parent 79447a7 commit f493a15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/DropdownItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ const DropdownItem: DropdownItem = React.forwardRef(
const navContext = useContext(NavContext);

const { activeKey } = navContext || {};
const key = makeEventKey(eventKey || null, href);
// TODO: Restrict eventKey to string in v5?
const key = makeEventKey(eventKey as any, href);

const active =
propActive == null && key != null
Expand Down
3 changes: 2 additions & 1 deletion src/ListGroupItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ const ListGroupItem: ListGroupItem = React.forwardRef(
<AbstractNavItem
ref={ref}
{...props}
eventKey={makeEventKey(eventKey || null, props.href)}
// TODO: Restrict eventKey to string in v5?
eventKey={makeEventKey(eventKey as any, props.href)}
// eslint-disable-next-line no-nested-ternary
as={as || (action ? (props.href ? 'a' : 'button') : 'div')}
onClick={handleClick}
Expand Down

0 comments on commit f493a15

Please sign in to comment.